public function testPrevious() { $root = new RootNode(); $parent_one = $this->createParentNode(); $first = $this->createNode(); $parent_one->append($first); $one = $this->createNode(); $parent_one->append($one); $root->append($parent_one); $parent_two = $this->createParentNode(); $second = $this->createNode(); $parent_two->append($second); $two = $this->createNode(); $parent_two->append($two); $root->append($parent_two); $collection = new NodeCollection([$one, $two]); $matches = $collection->previous(); $this->assertCount(2, $matches); $this->assertSame($first, $matches[0]); $this->assertSame($second, $matches[1]); }