it("loads the data", function () { $collection = new Collection(['data' => ['foo']]); expect($collection[0])->toBe('foo'); expect($collection)->toHaveLength(1); }); }); describe("->parent()", function () { 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); }); });