/** * @test */ public function parentsWillReturnTheSiteNodeAsRootLevelParent() { $siteNode = $this->createMock(NodeInterface::class); $firstLevelNode = $this->createMock(NodeInterface::class); $secondLevelNode = $this->createMock(NodeInterface::class); $siteNode->expects($this->any())->method('getPath')->will($this->returnValue('/site')); $mockContext = $this->getMockBuilder(\Neos\Neos\Domain\Service\ContentContext::class)->disableOriginalConstructor()->getMock(); $mockContext->expects($this->any())->method('getCurrentSiteNode')->will($this->returnValue($siteNode)); $firstLevelNode->expects($this->any())->method('getParent')->will($this->returnValue($siteNode)); $firstLevelNode->expects($this->any())->method('getPath')->will($this->returnValue('/site/first')); $secondLevelNode->expects($this->any())->method('getContext')->will($this->returnValue($mockContext)); $secondLevelNode->expects($this->any())->method('getParent')->will($this->returnValue($firstLevelNode)); $secondLevelNode->expects($this->any())->method('getPath')->will($this->returnValue('/site/first/second')); $context = array($secondLevelNode); $q = new FlowQuery($context); $operation = new ParentsOperation(); $operation->evaluate($q, array()); $output = $q->getContext(); $this->assertEquals(array($siteNode, $firstLevelNode), $output); }