public function testGetDepth() { $root = new Node(); $root->addChild($child1 = new Node('child1'))->addChild($child2 = new Node('child2'))->addChild($child3 = new Node('child3')); $child3->addChild($child4 = new Node("a"))->addChild(new Node("b")); $this->assertEquals(1, $child1->getDepth()); $this->assertEquals(0, $root->getDepth()); $this->assertEquals(2, $child4->getDepth()); }