Convenience method returns the root node for
this context workspace.
public getRootNode ( ) : Neos\ContentRepository\Domain\Model\NodeInterface | ||
return | Neos\ContentRepository\Domain\Model\NodeInterface |
/** * @test */ public function getChildNodesWithNodeTypeFilterWorks() { $documentNodeType = $this->nodeTypeManager->getNodeType('Neos.ContentRepository.Testing:Document'); $headlineNodeType = $this->nodeTypeManager->getNodeType('Neos.ContentRepository.Testing:Headline'); $imageNodeType = $this->nodeTypeManager->getNodeType('Neos.ContentRepository.Testing:Image'); $node = $this->context->getRootNode()->createNode('node-with-child-node', $documentNodeType); $node->createNode('headline', $headlineNodeType); $node->createNode('text', $imageNodeType); $this->assertCount(1, $node->getChildNodes('Neos.ContentRepository.Testing:Headline')); }
/** * @throws \Neos\ContentRepository\Exception\NodeTypeNotFoundException */ protected function createNodesForNodeSearchTest() { $rootNode = $this->context->getRootNode(); $newNode1 = $rootNode->createNode('test-node-1', $this->nodeTypeManager->getNodeType('Neos.ContentRepository.Testing:NodeType')); $newNode1->setProperty('test1', 'simpleTestValue'); $newNode2 = $rootNode->createNode('test-node-2', $this->nodeTypeManager->getNodeType('Neos.ContentRepository.Testing:NodeType')); $newNode2->setProperty('test2', 'simpleTestValue'); $newNode2 = $rootNode->createNode('test-node-3', $this->nodeTypeManager->getNodeType('Neos.ContentRepository.Testing:NodeType')); $newNode2->setProperty('test1', 'otherValue'); $this->persistenceManager->persistAll(); }
/** * @test */ public function nodeWithRelatedEntitiesWillTakeCareOfAddingToPersistence() { $identifier = Algorithms::generateUUID(); $template = new NodeTemplate(); $template->setName('new-node'); $template->setIdentifier($identifier); $newEntity = new Fixtures\RelatedEntity(); $newEntity->setFavoritePlace('Reykjavik'); $anotherNewEntity = new Fixtures\RelatedEntity(); $anotherNewEntity->setFavoritePlace('Japan'); $template->setProperty('entity', array($newEntity, $anotherNewEntity)); $rootNode = $this->context->getRootNode(); $newNode = $rootNode->createNodeFromTemplate($template); $this->persistenceManager->persistAll(); $this->persistenceManager->clearState(); $this->inject($this->contextFactory, 'contextInstances', array()); $newLiveContext = $this->contextFactory->create(array('workspaceName' => 'live')); $newNodeAgain = $newLiveContext->getNode('/new-node'); $entityArray = $newNodeAgain->getProperty('entity'); $this->assertCount(2, $entityArray); $this->assertEquals('Japan', $entityArray[1]->getFavoritePlace()); }