Esempio n. 1
0
 public function testGetDescendantsAndSelf()
 {
     $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([$a, $c, $d], $a->getDescendantsAndSelf());
     $this->assertEquals([$b, $e, $f], $b->getDescendantsAndSelf());
     $this->assertEquals([$root, $a, $c, $d, $b, $e, $f], $root->getDescendantsAndSelf());
 }