public function testNextUntil() { $root = new RootNode(); $parent_one = $this->createParentNode(); $parent_one->appendTo($root); $one = $this->createNode(); $one->appendTo($parent_one); $two = $this->createNode(); $two->appendTo($parent_one); $three = $this->createNode(); $three->appendTo($parent_one); $parent_two = $this->createParentNode(); $parent_two->appendTo($root); $first = $this->createNode(); $first->appendTo($parent_two); $second = $this->createNode(); $second->appendTo($parent_two); $third = $this->createNode(); $third->appendTo($parent_two); $collection = new NodeCollection([$one, $first], FALSE); $matches = $collection->nextUntil(function (Node $node) { return $node->next() === NULL; }); $this->assertCount(2, $matches); $this->assertSame($two, $matches[0]); $this->assertSame($second, $matches[1]); }