expect($this->schema->hasRelation('gallery'))->toBe(true); $this->schema->unbind('gallery'); expect($this->schema->hasRelation('gallery'))->toBe(false); }); }); describe("->relations", function () { it("returns all relation names", function () { $relations = $this->schema->relations(); sort($relations); expect($relations)->toBe(['gallery', 'images_tags', 'tags']); }); it("includes embedded relations using `true` as first parameter", function () { $model = Stub::classname(['extends' => Model::class]); $schema = new Schema(['model' => $model]); $schema->set('embedded', ['type' => 'object', 'model' => $model]); expect($schema->relations())->toBe(['embedded']); expect($schema->relations(false))->toBe([]); }); }); describe("->conventions()", function () { it("gets/sets the conventions", function () { $conventions = Stub::create(); $schema = new Schema(); expect($schema->conventions($conventions))->toBe($schema); expect($schema->conventions())->toBe($conventions); }); }); describe("->expand()", function () { it("expands schema paths", function () { expect($this->schema->expand(['gallery', 'tags']))->toBe(['gallery' => null, 'tags' => null, 'images_tags.tag' => null]); });