예제 #1
0
 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);
     });
 });
 describe("->prev()", function () {
     it("navigates through collection", function () {
         $collection = new Collection(['data' => [1, 2, 3]]);
         $collection->rewind();
         expect($collection->next())->toBe(2);