Exemple #1
0
 public function testGetDescendants()
 {
     $root = new Node('r');
     $root->addChild($a = new Node('a'))->addChild($b = new Node('b'));
     $a->addChild($c = new Node('c'))->addChild($d = new Node('d'));
     $b->addChild($e = new Node('e'))->addChild($f = new Node('f'));
     $this->assertEquals([$c, $d], $a->getDescendants());
     $this->assertEquals([$e, $f], $b->getDescendants());
     $this->assertEquals([$a, $c, $d, $b, $e, $f], $root->getDescendants());
 }