Exemplo n.º 1
0
 public function testGetAncestor()
 {
     $a = new Leaf(['kind' => 'a']);
     $div = new Node();
     $body = new Node(['kind' => 'body']);
     $body->appendChild($div)->appendChild($a);
     $ancestor = $a->getAncestor(2);
     $this->assertEquals($body, $ancestor);
 }
Exemplo n.º 2
0
 public function testGetNodesByKind()
 {
     $this->assertEquals([], self::$n->getNodesByKind('h1'));
     $this->assertEquals([self::$n0, self::$n1], self::$n->getNodesByKind('div'));
     $n = new Node($i = ['kind' => 'p']);
     self::$n1->appendChild($n);
     $this->assertEquals([$n], self::$n->getNodesByKind('p'));
     unset(self::$n1[0]);
 }