Neos\ContentRepository\Tests\Unit\Domain\Service\NodeServiceTest::cleanUpChildNodesRemoveAllUndeclaredChildNodes PHP Method

cleanUpChildNodesRemoveAllUndeclaredChildNodes() public method

    public function cleanUpChildNodesRemoveAllUndeclaredChildNodes()
    {
        $this->markTestSkipped('Currently this functionality is disabled. We will introduce it again at a later point and then reenable this test.');
        $nodeService = $this->createNodeService();
        $mockNode = $this->getMockBuilder(Node::class)->disableOriginalConstructor()->getMock();
        $mockNodeType = $this->mockNodeType('Neos.ContentRepository.Testing:Content');
        $mockContentNodeType = $this->mockNodeType('Neos.ContentRepository.Testing:ContentCollection');
        $mockFirstChildNode = $this->getMockBuilder(Node::class)->disableOriginalConstructor()->getMock();
        $mockFirstChildNode->expects($this->any())->method('getNodeType')->will($this->returnValue($mockContentNodeType));
        $mockFirstChildNode->expects($this->any())->method('getName')->will($this->returnValue('main'));
        $mockFirstChildNode->expects($this->never())->method('remove');
        $mockSecondChildNode = $this->getMockBuilder(Node::class)->disableOriginalConstructor()->getMock();
        $mockSecondChildNode->expects($this->any())->method('getNodeType')->will($this->returnValue($mockContentNodeType));
        $mockSecondChildNode->expects($this->any())->method('getName')->will($this->returnValue('sidebar'));
        $mockSecondChildNode->expects($this->never())->method('remove');
        $mockThirdChildNode = $this->getMockBuilder(Node::class)->disableOriginalConstructor()->getMock();
        $mockThirdChildNode->expects($this->any())->method('getNodeType')->will($this->returnValue($mockContentNodeType));
        $mockThirdChildNode->expects($this->any())->method('getName')->will($this->returnValue('footer'));
        $mockThirdChildNode->expects($this->once())->method('remove');
        $mockMainChildNodeType = $this->mockNodeType('Neos.ContentRepository.Testing:ContentCollection');
        $mockSidebarChildNodeType = $this->mockNodeType('Neos.ContentRepository.Testing:ContentCollection');
        $mockNodeType->expects($this->once())->method('getAutoCreatedChildNodes')->will($this->returnValue(array('main' => $mockMainChildNodeType, 'sidebar' => $mockSidebarChildNodeType)));
        $mockNode->expects($this->once())->method('getNodeType')->will($this->returnValue($mockNodeType));
        $mockNode->expects($this->once())->method('getChildNodes')->will($this->returnValue(array($mockFirstChildNode, $mockSecondChildNode, $mockThirdChildNode)));
        $nodeService->cleanUpChildNodes($mockNode);
    }