This object is not to be used for any other reason.
Inheritance: extends InnerNode
 public function testPreviousSibling()
 {
     $parent = new Node();
     $child = new Node();
     $child2 = new Node();
     $child->setParent($parent);
     $child2->setParent($parent);
     $this->assertEquals($child->id(), $child2->previousSibling()->id());
 }
Esempio n. 2
0
 public function testCountChildren()
 {
     $parent = new Node();
     $child = new Node();
     $child2 = new Node();
     $child->setParent($parent);
     $child2->setParent($parent);
     $this->assertEquals(2, $parent->countChildren());
 }
Esempio n. 3
0
 public function testIsChild()
 {
     $parent = new Node();
     $child1 = new Node();
     $child2 = new Node();
     $child1->setParent($parent);
     $child2->setParent($child1);
     $this->assertTrue($parent->isChild($child1->id()));
     $this->assertTrue($parent->isDescendant($child2->id()));
     $this->assertFalse($parent->isChild($child2->id()));
 }
Esempio n. 4
0
 public function testLastChild()
 {
     $parent = new Node();
     $child = new Node();
     $child2 = new Node();
     $child3 = new Node();
     $parent->addChild($child);
     $parent->addChild($child2);
     $parent->addChild($child3);
     $this->assertEquals($child3->id(), $parent->lastChild()->id());
 }
Esempio n. 5
0
 public function testGetAncestorNotFound()
 {
     $parent = new Node();
     $ancestor = $parent->getAncestor(1);
     $this->assertNull($ancestor);
 }