Beispiel #1
0
     $this->preferences->column('preferences.mail.enabled', ['type' => 'boolean', 'default' => true]);
     $this->preferences->column('preferences.mail.frequency', ['type' => 'integer', 'default' => 24]);
 });
 afterEach(function () {
     Image::reset();
 });
 describe("->__construct()", function () {
     it("correctly sets config options", function () {
         $connection = Double::instance();
         $conventions = Double::instance();
         allow($connection)->toReceive('formatters')->andReturn([]);
         $schema = new Schema(['connection' => $connection, 'source' => 'image', 'model' => Image::class, 'key' => 'key', 'locked' => false, 'columns' => ['id' => 'serial', 'age' => 'integer'], 'meta' => ['some' => ['meta']], 'conventions' => $conventions]);
         expect($schema->connection())->toBe($connection);
         expect($schema->source())->toBe('image');
         expect($schema->model())->toBe(Image::class);
         expect($schema->key())->toBe('key');
         expect($schema->locked())->toBe(false);
         expect($schema->fields())->toBe(['id', 'age']);
         expect($schema->meta())->toBe(['some' => ['meta']]);
         expect($schema->conventions())->toBe($conventions);
     });
 });
 describe("->connection()", function () {
     it("gets/sets the connection", function () {
         $connection = Double::instance();
         $schema = new Schema();
         expect($schema->connection($connection))->toBe($schema);
         expect($schema->connection())->toBe($connection);
     });
 });
 describe("->source()", function () {