getNode() public method

Returns a node specified by the given absolute path.
public getNode ( string $path ) : Neos\ContentRepository\Domain\Model\NodeInterface
$path string Absolute path specifying the node
return Neos\ContentRepository\Domain\Model\NodeInterface The specified node or NULL if no such node exists
 /**
  * @test
  */
 public function createNodeFromTemplateUsesWorkspacesOfContext()
 {
     $nodeTemplate = $this->generateBasicNodeTemplate();
     $userWorkspace = new Workspace('user1', $this->liveWorkspace);
     $this->workspaceRepository->add($userWorkspace);
     $this->context = $this->contextFactory->create(array('workspaceName' => 'user1'));
     $rootNode = $this->context->getNode('/');
     $node = $rootNode->createNodeFromTemplate($nodeTemplate, 'just-a-node');
     $workspace = $node->getWorkspace();
     $this->assertEquals('user1', $workspace->getName(), 'Node should be created in workspace of context');
 }
 /**
  * @return void
  */
 protected function setUpRootNodeAndRepository()
 {
     $this->contextFactory = $this->objectManager->get(ContextFactory::class);
     $this->context = $this->contextFactory->create(array('workspaceName' => 'live'));
     $this->nodeDataRepository = $this->objectManager->get(NodeDataRepository::class);
     $this->workspaceRepository = $this->objectManager->get(WorkspaceRepository::class);
     $this->workspaceRepository->add(new Workspace('live'));
     $this->nodeTypeManager = $this->objectManager->get(NodeTypeManager::class);
     $this->rootNode = $this->context->getNode('/');
     $this->persistenceManager->persistAll();
 }
 /**
  * @test
  */
 public function getPropertyReturnsReferencedNodesInCorrectWorkspace()
 {
     $nodeTypeManager = $this->objectManager->get(NodeTypeManager::class);
     $nodeType = $nodeTypeManager->getNodeType('Neos.ContentRepository.Testing:NodeTypeWithReferences');
     $identifier = '81c848ed-abb5-7608-a5db-7eea0331ccfa';
     $rootNode = $this->context->getNode('/');
     $referencedNode = $rootNode->createNode('referenced-node', $nodeType, $identifier);
     $node = $rootNode->createNode('node', $nodeType, '30e893c1-caef-0ca5-b53d-e5699bb8e506');
     $node->setProperty('property2', $identifier);
     $testContext = $this->contextFactory->create(['workspaceName' => 'test']);
     $testRootNode = $testContext->getNode('/');
     $testReferencedNode = $testRootNode->createNode('test-referenced-node', $nodeType, $identifier);
     $testNode = $testRootNode->getNode('node');
     $referencedNodeProperty = $node->getProperty('property2');
     $this->assertNotSame($referencedNodeProperty->getWorkspace(), $testReferencedNode->getWorkspace());
     $this->assertSame($referencedNodeProperty->getWorkspace(), $referencedNode->getWorkspace());
     $testReferencedNodeProperty = $testNode->getProperty('property2');
     $this->assertNotSame($testReferencedNodeProperty->getWorkspace(), $referencedNode->getWorkspace());
     $this->assertSame($testReferencedNodeProperty->getWorkspace(), $testReferencedNode->getWorkspace());
 }