/** * @test */ public function removedNodeWithoutExistingTargetNodeDataWillBeRemovedWhenPublished() { $homepageNode = $this->rootNode->createNode('homepage'); $homepageNode->remove(); $this->rootNode->getWorkspace()->publish($this->liveWorkspace); $this->saveNodesAndTearDownRootNodeAndRepository(); $this->setUpRootNodeAndRepository(); $liveContext = $this->contextFactory->create(array('workspaceName' => 'live', 'removedContentShown' => TRUE)); $liveRootNode = $liveContext->getRootNode(); $liveHomepageNode = $liveRootNode->getNode('homepage'); $this->assertTrue($liveHomepageNode === NULL, 'A removed node should be removed after publishing, but it was still found'); }
/** * @test */ public function aSingleNodeExportedWithNodeDataExportCanBeImportedWithNodeDataImport() { $originalNode = $this->rootNode->createNode('foo', $this->nodeTypeManager->getNodeType('TYPO3.TYPO3CR.Testing:ImportExport')); $originalNode->setProperty('description', 'Some node with a property'); $originalNode->setProperty('someDate', new \DateTime()); $this->persistenceManager->persistAll(); $exportService = new NodeExportService(); $xml = $exportService->export('/')->outputMemory(); $this->nodeDataRepository->removeAll(); $this->workspaceRepository->removeAll(); $this->saveNodesAndTearDownRootNodeAndRepository(); $this->setUpRootNodeAndRepository(); $importService = new NodeImportService(); $reader = new \XMLReader(); $reader->XML($xml); $importService->import($reader, '/'); $importedNode = $this->rootNode->getNode('foo'); $this->assertNotNull($importedNode, 'Expected node not found'); $this->assertSame($originalNode->getIdentifier(), $importedNode->getIdentifier()); $this->assertSame($originalNode->getProperty('description'), $importedNode->getProperty('description')); $this->assertEquals($originalNode->getProperty('someDate'), $importedNode->getProperty('someDate')); }
/** * For test setup / node structure, see nodesWhichAreMovedAcrossLevelsAndWorkspacesShouldBeRemovedFromOriginalLocation * * Here, we move childNodeC underneath childNodeA. * * @test */ public function nodesWhichAreMovedAcrossLevelsAndWorkspacesShouldWorkWhenUsingPrimaryChildNode() { $parentNode = $this->rootNode->createNode('parentNode'); $parentNode->createNode('childNodeA'); $childNodeB = $parentNode->createNode('childNodeB'); $childNodeB->createNode('childNodeC'); $parentNode->getWorkspace()->publish($this->liveWorkspace); $this->saveNodesAndTearDownRootNodeAndRepository(); $this->setUpRootNodeAndRepository(); $childNodeC2 = $this->rootNode->getNode('parentNode/childNodeB/childNodeC'); $childNodeA2 = $this->rootNode->getNode('parentNode/childNodeA'); $childNodeC2->moveInto($childNodeA2); $this->saveNodesAndTearDownRootNodeAndRepository(); $this->setUpRootNodeAndRepository(); $childNodeB3 = $this->rootNode->getNode('parentNode/childNodeB'); $this->assertNull($childNodeB3->getPrimaryChildNode()); $childNodeA3 = $this->rootNode->getNode('parentNode/childNodeA'); $childNodeC3 = $childNodeA3->getPrimaryChildNode(); $this->assertNotNull($childNodeC3); }