Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 27 additions & 27 deletions tests/11_Import/ImportRepositoryContentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public function testImportXMLUuidRemoveParentSession()
{
self::$staticSharedFixture['ie']->import('11_Import/idnode');
$session = $this->renewSession();
$session->importXML('/container/idExample', __DIR__.'/../../fixtures/general/base.xml', ImportUUIDBehaviorInterface::IMPORT_UUID_COLLISION_REMOVE_EXISTING);
$session->importXML('/test/container/idExample', __DIR__.'/../../fixtures/general/base.xml', ImportUUIDBehaviorInterface::IMPORT_UUID_COLLISION_REMOVE_EXISTING);
}

/**
Expand All @@ -115,7 +115,7 @@ public function testImportXMLUuidRemoveParentWorkspace()
{
self::$staticSharedFixture['ie']->import('11_Import/idnode');
$session = $this->renewSession();
$session->getWorkspace()->importXML('/container/idExample', __DIR__.'/../../fixtures/general/base.xml', ImportUUIDBehaviorInterface::IMPORT_UUID_COLLISION_REMOVE_EXISTING);
$session->getWorkspace()->importXML('/test/container/idExample', __DIR__.'/../../fixtures/general/base.xml', ImportUUIDBehaviorInterface::IMPORT_UUID_COLLISION_REMOVE_EXISTING);
}

public function testImportXMLUuidNewSession()
Expand All @@ -135,8 +135,8 @@ private function doTestImportXMLUuidNew($connect, $session)
$connect->importXML('/', __DIR__.'/../../fixtures/general/base.xml', ImportUUIDBehaviorInterface::IMPORT_UUID_CREATE_NEW);

// existing node did not change its uuid
$this->assertTrue($session->nodeExists('/container/idExample'));
$idExample = $session->getNode('/container/idExample');
$this->assertTrue($session->nodeExists('/test/container/idExample'));
$idExample = $session->getNode('/test/container/idExample');
$this->assertEquals('842e61c0-09ab-42a9-87c0-308ccc90e6f4', $idExample->getIdentifier());

$this->assertTrue($session->nodeExists('/tests_general_base'));
Expand All @@ -149,8 +149,8 @@ private function doTestImportXMLUuidNew($connect, $session)
$session = $this->saveAndRenewSession();

// existing node did not change its uuid
$this->assertTrue($session->nodeExists('/container/idExample'));
$idExample = $session->getNode('/container/idExample');
$this->assertTrue($session->nodeExists('/test/container/idExample'));
$idExample = $session->getNode('/test/container/idExample');
$this->assertEquals('842e61c0-09ab-42a9-87c0-308ccc90e6f4', $idExample->getIdentifier());

$this->assertTrue($session->nodeExists('/tests_general_base'));
Expand Down Expand Up @@ -196,7 +196,7 @@ private function doTestImportXMLUuidRemoveExisting($connect, $session)
$connect->importXML('/', __DIR__.'/../../fixtures/general/base.xml', ImportUUIDBehaviorInterface::IMPORT_UUID_COLLISION_REMOVE_EXISTING);

// existing node removed
$this->assertFalse($session->nodeExists('/container/idExample'));
$this->assertFalse($session->nodeExists('/test/container/idExample'));

// the rest is the same as with empty repo
$this->assertTrue($session->nodeExists('/tests_general_base'));
Expand All @@ -216,7 +216,7 @@ private function doTestImportXMLUuidRemoveExisting($connect, $session)
$session = $this->saveAndRenewSession();

// existing node removed
$this->assertFalse($session->nodeExists('/container/idExample'));
$this->assertFalse($session->nodeExists('/test/container/idExample'));

// the rest is the same as with empty repo
$this->assertTrue($session->nodeExists('/tests_general_base'));
Expand Down Expand Up @@ -247,38 +247,38 @@ private function doTestImportXMLUuidReplaceExisting($connect, $session)
$session->importXML('/', __DIR__.'/../../fixtures/general/base.xml', ImportUUIDBehaviorInterface::IMPORT_UUID_COLLISION_REPLACE_EXISTING);

// existing node replaced
$this->assertTrue($session->nodeExists('/container/idExample'));
$idExample = $session->getNode('/container/idExample');
$this->assertTrue($session->nodeExists('/test/container/idExample'));
$idExample = $session->getNode('/test/container/idExample');
$this->assertEquals('nt:file', $idExample->getPrimaryNodeType()->getName());
$this->assertEquals('842e61c0-09ab-42a9-87c0-308ccc90e6f4', $idExample->getIdentifier());
$this->assertTrue($session->nodeExists('/container/idExample/jcr:content'));
$this->assertTrue($session->nodeExists('/test/container/idExample/jcr:content'));

$this->assertFalse($session->nodeExists('/tests_general_base/idExample'));

// the rest is the same as with empty repo
$this->assertTrue($session->nodeExists('/tests_general_base'));
$this->assertTrue($session->nodeExists('/tests_general_base/test:namespacedNode'));

$ref = $session->getProperty('/container/idExample/jcr:content/weakreference_source1/ref1');
$ref = $session->getProperty('/test/container/idExample/jcr:content/weakreference_source1/ref1');
$this->assertEquals(\PHPCR\PropertyType::WEAKREFERENCE, $ref->getType());
$this->assertEquals('13543fc6-1abf-4708-bfcc-e49511754b40', $ref->getString());

$session = $this->saveAndRenewSession();

// existing node replaced
$this->assertTrue($session->nodeExists('/container/idExample'));
$idExample = $session->getNode('/container/idExample');
$this->assertTrue($session->nodeExists('/test/container/idExample'));
$idExample = $session->getNode('/test/container/idExample');
$this->assertEquals('nt:file', $idExample->getPrimaryNodeType()->getName());
$this->assertEquals('842e61c0-09ab-42a9-87c0-308ccc90e6f4', $idExample->getIdentifier());
$this->assertTrue($session->nodeExists('/container/idExample/jcr:content'));
$this->assertTrue($session->nodeExists('/test/container/idExample/jcr:content'));

$this->assertFalse($session->nodeExists('/tests_general_base/idExample'));

// the rest is the same as with empty repo
$this->assertTrue($session->nodeExists('/tests_general_base'));
$this->assertTrue($session->nodeExists('/tests_general_base/test:namespacedNode'));

$ref = $session->getProperty('/container/idExample/jcr:content/weakreference_source1/ref1');
$ref = $session->getProperty('/test/container/idExample/jcr:content/weakreference_source1/ref1');
$this->assertEquals(\PHPCR\PropertyType::WEAKREFERENCE, $ref->getType());
$this->assertEquals('13543fc6-1abf-4708-bfcc-e49511754b40', $ref->getString());
}
Expand Down Expand Up @@ -342,8 +342,8 @@ public function testImportXMLDocument()
$session->importXML('/', __DIR__.'/../../fixtures/11_Import/documentview.xml', ImportUUIDBehaviorInterface::IMPORT_UUID_CREATE_NEW);

// existing node did not change its uuid
$this->assertTrue($session->nodeExists('/container/idExample'));
$idExample = $session->getNode('/container/idExample');
$this->assertTrue($session->nodeExists('/test/container/idExample'));
$idExample = $session->getNode('/test/container/idExample');
$this->assertEquals('842e61c0-09ab-42a9-87c0-308ccc90e6f4', $idExample->getIdentifier());

$this->assertTrue($session->nodeExists('/tests_import'));
Expand All @@ -359,8 +359,8 @@ public function testImportXMLDocument()
$session = $this->saveAndRenewSession();

// existing node did not change its uuid
$this->assertTrue($session->nodeExists('/container/idExample'));
$idExample = $session->getNode('/container/idExample');
$this->assertTrue($session->nodeExists('/test/container/idExample'));
$idExample = $session->getNode('/test/container/idExample');
$this->assertEquals('842e61c0-09ab-42a9-87c0-308ccc90e6f4', $idExample->getIdentifier());

$this->assertTrue($session->nodeExists('/tests_import'));
Expand All @@ -379,16 +379,16 @@ public function testImportXMLDocumentSimple()
self::$staticSharedFixture['ie']->import('11_Import/empty');
$session = $this->renewSession();

$session->importXML('/', __DIR__.'/../../fixtures/11_Import/simple.xml', ImportUUIDBehaviorInterface::IMPORT_UUID_COLLISION_THROW);
$session->importXML('/tests_import', __DIR__.'/../../fixtures/11_Import/simple.xml', ImportUUIDBehaviorInterface::IMPORT_UUID_COLLISION_THROW);

$this->assertTrue($session->nodeExists('/data/node'));
$this->assertTrue($session->nodeExists('/data/sibling/child1'));
$this->assertEquals('Test', $session->getProperty('/data/sibling/title')->getValue());
$this->assertTrue($session->nodeExists('/tests_import/data/node'));
$this->assertTrue($session->nodeExists('/tests_import/data/sibling/child1'));
$this->assertEquals('Test', $session->getProperty('/tests_import/data/sibling/title')->getValue());

$session = $this->saveAndRenewSession();

$this->assertTrue($session->nodeExists('/data/node'));
$this->assertTrue($session->nodeExists('/data/sibling/child1'));
$this->assertEquals('Test', $session->getProperty('/data/sibling/title')->getValue());
$this->assertTrue($session->nodeExists('/tests_import/data/node'));
$this->assertTrue($session->nodeExists('/tests_import/data/sibling/child1'));
$this->assertEquals('Test', $session->getProperty('/tests_import/data/sibling/title')->getValue());
}
}