Creates, adds and returns a child node of this node. Also sets default
properties and creates default subnodes.
public createNode ( string $name, |
||
$name | string | Name of the new node |
$nodeType | Node type of the new node (optional) | |
$identifier | string | The identifier of the node, unique within the workspace, optional(!) |
return | Neos\ContentRepository\Domain\Model\NodeInterface |
/** * @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('Neos.ContentRepository.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')); }