Esempio n. 1
0
     $this->fixtures->populate('tag', ['create']);
     $this->gallery = $this->fixtures->get('gallery')->model();
     $this->galleryDetail = $this->fixtures->get('gallery_detail')->model();
     $this->image = $this->fixtures->get('image')->model();
     $this->image_tag = $this->fixtures->get('image_tag')->model();
     $this->tag = $this->fixtures->get('tag')->model();
 });
 afterEach(function () {
     $this->fixtures->drop();
     $this->fixtures->reset();
 });
 describe("->query()", function () {
     it("throw an exception when no model is set", function () {
         $closure = function () {
             $schema = new Schema(['connection' => $this->connection]);
             $schema->query();
         };
         expect($closure)->toThrow(new DatabaseException("Missing model for this schema, can't create a query."));
     });
 });
 describe("->create()/->drop()", function () {
     it("creates/drop a table", function () {
         $this->fixtures->drop();
         $schema = new Schema(['connection' => $this->connection, 'source' => 'test_table']);
         $schema->set('id', ['type' => 'serial']);
         $schema->create();
         expect($this->connection->sources())->toBe(['test_table' => 'test_table']);
         $schema->drop();
         expect($this->connection->sources())->toBe([]);
     });
     it("throw an exception when source is not set", function () {