namespace chaos\spec\suite; use InvalidArgumentException; use chaos\Cursor; use kahlan\plugin\Stub; describe("Cursor", function () { describe("->__construct()", function () { it("loads the data", function () { $cursor = new Cursor(['data' => ['foo']]); expect($cursor->current())->toBe('foo'); }); }); describe("->key()", function () { it("returns current key", function () { $cursor = new Cursor(['data' => [1, 2, 3, 4, 5]]); expect($cursor->key())->toBe(0); $cursor->next(); expect($cursor->key())->toBe(1); $cursor->next(); expect($cursor->key())->toBe(2); $cursor->next(); expect($cursor->key())->toBe(3); $cursor->next(); expect($cursor->key())->toBe(4); $cursor->next(); expect($cursor->key())->toBe(null); }); }); describe("->current()", function () { it("returns the current value", function () { $cursor = new Cursor(['data' => [1, 2, 3, 4, 5]]);