public function testGetDescendants() { $n = new Node(); self::$n1->appendChild($n); // Leaves only $this->assertEquals([self::$n0, $n, self::$n2], self::$n->getDescendants(0)); // Self first $this->assertEquals([self::$n0, self::$n1, $n, self::$n2], self::$n->getDescendants(1)); // Leaves first $this->assertEquals([self::$n0, $n, self::$n1, self::$n2], self::$n->getDescendants(2)); unset(self::$n1[0]); }