Example #1
0
         $parent->value = $collection;
         unset($parent->value);
         expect($collection->parents()->has($parent))->toBe(false);
     });
 });
 describe("->basePath()", function () {
     it("returns the root path", function () {
         $collection = new Collection(['basePath' => 'items']);
         expect($collection->basePath())->toBe('items');
     });
 });
 describe("->schema()", function () {
     it("returns the schema", function () {
         $schema = new Schema();
         $collection = new Collection(['schema' => $schema]);
         expect($collection->schema())->toBe($schema);
     });
 });
 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 () {
     beforeEach(function () {
         $this->collection = new Collection();
         $class = Double::classname();
         allow($class)->toReceive('hello')->andRun(function () {
             return 'world';
         });