Example #1
0
     it("gets the parent", function () {
         $parent = Stub::create();
         $collection = new Collection(['parent' => $parent]);
         expect($collection->parent())->toBe($parent);
     });
     it("sets a parent", function () {
         $parent = Stub::create();
         $collection = new Collection();
         $collection->parent($parent);
         expect($collection->parent())->toBe($parent);
     });
 });
 describe("->rootPath()", function () {
     it("returns the root path", function () {
         $collection = new Collection(['rootPath' => 'items']);
         expect($collection->rootPath())->toBe('items');
     });
 });
 describe("->model()", function () {
     it("returns the model", function () {
         $collection = new Collection(['model' => Model::class]);
         expect($collection->model())->toBe(Model::class);
     });
 });
 describe("->meta()", function () {
     it("returns the meta attributes", function () {
         $collection = new Collection(['meta' => ['page' => 5, 'limit' => 10]]);
         expect($collection->meta())->toBe(['page' => 5, 'limit' => 10]);
     });
 });
 describe("->invoke()", function () {