Neos\ContentRepository\Tests\Functional\Eel\FlowQueryOperations\ClosestOperationTest::closestOperationTests PHP Метод

closestOperationTests() публичный Метод

a a1 a2 b (TestingNodeType) b1 (TestingNodeType) b1a b2 b3 (TestingNodeTypeWithSubnodes) b3a (TestingNodeType) b3b
public closestOperationTests ( $currentNodePath, $nodeTypeFilter, $expectedNodePath )
    public function closestOperationTests($currentNodePath, $nodeTypeFilter, $expectedNodePath)
    {
        $nodeTypeManager = $this->objectManager->get(NodeTypeManager::class);
        $testNodeType1 = $nodeTypeManager->getNodeType('Neos.ContentRepository.Testing:NodeType');
        $testNodeType2 = $nodeTypeManager->getNodeType('Neos.ContentRepository.Testing:NodeTypeWithSubnodes');
        $rootNode = $this->node->getNode('/');
        $nodeA = $rootNode->createNode('a');
        $nodeA->createNode('a1');
        $nodeA->createNode('a2');
        $nodeB = $rootNode->createNode('b', $testNodeType1);
        $nodeB1 = $nodeB->createNode('b1', $testNodeType1);
        $nodeB1->createNode('b1a');
        $nodeB->createNode('b2');
        $nodeB3 = $nodeB->createNode('b3', $testNodeType2);
        $nodeB3->createNode('b3a', $testNodeType1);
        $nodeB3->createNode('b3b');
        $currentNode = $rootNode->getNode($currentNodePath);
        $q = new FlowQuery(array($currentNode));
        $actualNode = $q->closest($nodeTypeFilter)->get(0);
        if ($expectedNodePath === null) {
            if ($actualNode !== null) {
                $this->fail('Expected resulting node to be NULL');
            }
            $this->assertNull($actualNode);
        } else {
            $this->assertSame($expectedNodePath, $actualNode->getPath());
        }
    }