Exemplo n.º 1
0
         expect($collection->prev())->toBe(null);
     });
 });
 describe("->rewind/end()", function () {
     it("returns respectively the first and the last item of the collection", function () {
         $collection = new Collection(['data' => [1, 2, 3, 4, 5]]);
         expect($collection->end())->toBe(5);
         expect($collection->rewind())->toBe(1);
     });
 });
 describe("->valid()", function () {
     it("returns true only when the collection is valid", function () {
         $collection = new Collection();
         expect($collection->valid())->toBe(false);
         $collection = new Collection(['data' => [1, 5]]);
         expect($collection->valid())->toBe(true);
     });
 });
 describe("->count()", function () {
     it("returns 0 on empty", function () {
         $collection = new Collection();
         expect($collection)->toHaveLength(0);
     });
     it("returns the number of items in the collection", function () {
         $collection = new Collection(['data' => [5, null, 4, true, false, 'bob']]);
         expect($collection)->toHaveLength(6);
     });
 });
 describe("->merge()", function () {
     it("merges two collection", function () {
         $collection = new Collection(['data' => [1, 2, 3]]);