NodeTest::testNodeHasChildren PHP Méthode

testNodeHasChildren() public méthode

SetUp for hasChildren
public testNodeHasChildren ( ) : void
Résultat void
    public function testNodeHasChildren()
    {
        $parent = NodeFactory::getInstance();
        $empty_container = NodeFactory::getInstance('Node', 'empty', Node::CONTAINER);
        $child = NodeFactory::getInstance();
        // test with no children
        $this->assertEquals($parent->hasChildren(true), false);
        $this->assertEquals($parent->hasChildren(false), false);
        // test with an empty container
        $parent->addChild($empty_container);
        $this->assertEquals($parent->hasChildren(true), true);
        $this->assertEquals($parent->hasChildren(false), false);
        // test with a real child
        $parent->addChild($child);
        $this->assertEquals($parent->hasChildren(true), true);
        $this->assertEquals($parent->hasChildren(false), true);
    }