public function testMap() { $root = new RootNode(); $parent_one = $this->createParentNode(); $parent_one->appendTo($root); $one = $this->createNode(); $one->appendTo($parent_one); $parent_two = $this->createParentNode(); $parent_two->appendTo($root); $first = $this->createNode(); $first->appendTo($parent_two); $collection = new NodeCollection([$parent_one, $parent_two], FALSE); $map = $collection->map(function (ParentNode $node) { return $node->firstChild(); }); $this->assertCount(2, $map); $this->assertSame($one, $map[0]); $this->assertSame($first, $map[1]); }