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 () { beforeEach(function () { $this->collection = new Collection(); $class = Stub::classname(); Stub::on($class)->method('hello', function () { return 'world'; }); for ($i = 0; $i < 5; $i++) { $this->collection[] = new $class(); } }); it("dispatches a method against all items in the collection", function () { foreach ($this->collection as $instance) {