describe("->get()", function () { it("returns the plain data", function () { $data = ['key1' => 'one', 'key2' => 'two', 'key3' => 'three']; $collection = new Collection(compact('data')); expect($collection->get())->toBe($data); }); }); describe("->key()", function () { it("returns current key", function () { $collection = new Collection(['data' => [1, 2, 3, 4, 5]]); $value = $collection->key(); expect($value)->toBe(0); }); it("returns null if non valid", function () { $collection = new Collection(); $value = $collection->key(); expect($value)->toBe(null); }); }); describe("->current()", function () { it("returns the current value", function () { $collection = new Collection(['data' => [1, 2, 3, 4, 5]]); $value = $collection->current(); expect($value)->toBe(1); }); }); describe("->next()", function () { it("returns the next value", function () { $collection = new Collection(['data' => [1, 2, 3, 4, 5]]); $value = $collection->next(); expect($value)->toBe(2);