describe("->current()", function () { it("returns current value", function () { $collection = new Collection([1, 2, 3, 4, 5]); $value = $collection->current(); expect($value)->toBe(1); }); }); describe("->prev()/->next()", function () { it("returns prev value", function () { $collection = new Collection([1, 2, 3]); $collection->rewind(); expect($collection->next())->toBe(2); expect($collection->next())->toBe(3); expect($collection->next())->toBe(null); $collection->end(); expect($collection->prev())->toBe(2); expect($collection->prev())->toBe(1); expect($collection->prev())->toBe(null); }); }); describe("->first()/->rewind()/->end()", function () { it("returns respectively the first and the last item of the collection", function () { $collection = new Collection([1, 2, 3, 4, 5]); expect($collection->end())->toBe(5); expect($collection->rewind())->toBe(1); expect($collection->end())->toBe(5); expect($collection->first())->toBe(1); }); }); describe("->valid()", function () { it("returns true only when the collection is valid", function () {