public function testHas() { $root = new RootNode(); $parent_one = $this->createParentNode(); $one = $this->createNode(); $parent_one->append($one); $root->append($parent_one); $parent_two = $this->createParentNode(); $two = $this->createNode(); $parent_two->append($two); $root->append($parent_two); $collection = new NodeCollection([$parent_one, $parent_two]); $matches = $collection->has(function (Node $node) use($one) { return $node === $one; }); $this->assertCount(1, $matches); $this->assertSame($parent_one, $matches[0]); }