diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c11e378..b79fc68 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,24 +1,32 @@ name: CI + on: schedule: - cron: '0 0 * * *' push: pull_request: + jobs: tests: - runs-on: 'ubuntu-latest' + runs-on: ubuntu-latest + name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }} + strategy: matrix: php: ['8.0', '8.1', '8.2'] - laravel: ['8', '9', '10'] + laravel: ['9', '10', '11'] exclude: - - php: '8.2' - laravel: '8' - php: '8.0' laravel: '10' + - laravel: '11' + php: '8.0' + - laravel: '11' + php: '8.1' + steps: - uses: actions/checkout@v3 + - name: Setup PHP uses: shivammathur/setup-php@v2 with: diff --git a/composer.json b/composer.json index 94ce481..13e1daf 100644 --- a/composer.json +++ b/composer.json @@ -1,46 +1,46 @@ { - "name": "laravel-doctrine/migrations", - "type": "library", - "description": "Doctrine Migrations for Laravel", - "license": "MIT", - "keywords": [ - "doctrine", - "laravel", - "orm", - "data mapper", - "database", - "migrations" - ], - "authors": [ - { - "name": "Patrick Brouwers", - "email": "patrick@maatwebsite.nl" + "name": "laravel-doctrine/migrations", + "type": "library", + "description": "Doctrine Migrations for Laravel", + "license": "MIT", + "keywords": [ + "doctrine", + "laravel", + "orm", + "data mapper", + "database", + "migrations" + ], + "authors": [ + { + "name": "Patrick Brouwers", + "email": "patrick@maatwebsite.nl" + } + ], + "require": { + "php": "^8", + "doctrine/migrations": "^3.4", + "doctrine/dbal": "^2.10.1|^3", + "illuminate/config": "^9.0|^10.0|^11.0", + "illuminate/contracts": "^9.0|^10.0|^11.0", + "illuminate/console": "^9.0|^10.0|^11.0", + "laravel-doctrine/orm": "^2.0" + }, + "require-dev": { + "phpunit/phpunit": "^7.0 | ^8.3 | ^9.3", + "phpstan/phpstan": "^1.9", + "mockery/mockery": "^1.3.1" + }, + "autoload": { + "psr-4": { + "LaravelDoctrine\\Migrations\\": "src/" + } + }, + "extra": { + "laravel": { + "providers": [ + "LaravelDoctrine\\Migrations\\MigrationsServiceProvider" + ] + } } - ], - "require": { - "php": "^7.4|^8", - "doctrine/migrations": "^3.4", - "doctrine/dbal": "^2.10.1|^3", - "illuminate/config": "^6.0|^7.0|^8.0|^9.0|^10.0", - "illuminate/contracts": "^6.0|^7.0|^8.0|^9.0|^10.0", - "illuminate/console": "^6.0|^7.0|^8.0|^9.0|^10.0", - "laravel-doctrine/orm": "^1.0|^2.0" - }, - "require-dev": { - "phpunit/phpunit": "^7.0 | ^8.3 | ^9.3", - "phpstan/phpstan": "^1.9", - "mockery/mockery": "^1.3.1" - }, - "autoload": { - "psr-4": { - "LaravelDoctrine\\Migrations\\": "src/" - } - }, - "extra": { - "laravel": { - "providers": [ - "LaravelDoctrine\\Migrations\\MigrationsServiceProvider" - ] - } - } } diff --git a/tests/Schema/SchemaTableTest.php b/tests/Schema/SchemaTableTest.php index 77907f3..a4a03d8 100644 --- a/tests/Schema/SchemaTableTest.php +++ b/tests/Schema/SchemaTableTest.php @@ -30,35 +30,35 @@ protected function setUp(): void public function test_guid() { - $this->dbal->shouldReceive('addColumn')->with('guid', 'guid'); + $this->dbal->shouldReceive('addColumn')->with('guid', 'guid')->once(); $this->table->guid('guid'); } public function test_primary() { - $this->dbal->shouldReceive('setPrimaryKey')->with(['id'], null); + $this->dbal->shouldReceive('setPrimaryKey')->with(['id'], null)->once(); $this->table->primary('id'); } public function test_unique() { - $this->dbal->shouldReceive('addUniqueIndex')->with(['email'], null, []); + $this->dbal->shouldReceive('addUniqueIndex')->with(['email'], null, [])->once(); $this->table->unique('email'); } public function test_index() { - $this->dbal->shouldReceive('addIndex')->with(['email'], null, [], []); + $this->dbal->shouldReceive('addIndex')->with(['email'], null, [], [])->once(); $this->table->index('email'); } public function test_foreign() { - $this->dbal->shouldReceive('addForeignKeyConstraint')->with('users', ['user_id'], ['id'], [], null); + $this->dbal->shouldReceive('addForeignKeyConstraint')->with('users', ['user_id'], ['id'], [], null)->once(); $this->table->foreign('users', 'user_id', 'id'); } @@ -72,8 +72,8 @@ public function test_increments() 'autoIncrement' => true, 'unsigned' => true ] - ); - $this->dbal->shouldReceive('setPrimaryKey')->with(['id'], null); + )->once(); + $this->dbal->shouldReceive('setPrimaryKey')->with(['id'], null)->once(); $this->table->increments('id'); } @@ -87,8 +87,8 @@ public function test_small_increments() 'autoIncrement' => true, 'unsigned' => true ] - ); - $this->dbal->shouldReceive('setPrimaryKey')->with(['id'], null); + )->once(); + $this->dbal->shouldReceive('setPrimaryKey')->with(['id'], null)->once(); $this->table->smallIncrements('id'); } @@ -102,21 +102,21 @@ public function test_big_increments() 'autoIncrement' => true, 'unsigned' => true ] - ); - $this->dbal->shouldReceive('setPrimaryKey')->with(['id'], null); + )->once(); + $this->dbal->shouldReceive('setPrimaryKey')->with(['id'], null)->once(); $this->table->bigIncrements('id'); } public function test_string() { - $this->dbal->shouldReceive('addColumn')->with('string', 'string', ['length' => 255]); + $this->dbal->shouldReceive('addColumn')->with('string', 'string', ['length' => 255])->once(); $this->table->string('string'); } public function test_text() { - $this->dbal->shouldReceive('addColumn')->with('text', 'text'); + $this->dbal->shouldReceive('addColumn')->with('text', 'text')->once(); $this->table->text('text'); } @@ -125,13 +125,13 @@ public function test_integer() $this->dbal->shouldReceive('addColumn')->with('column', 'integer', [ 'autoIncrement' => false, 'unsigned' => false - ]); + ])->once(); $this->table->integer('column'); $this->dbal->shouldReceive('addColumn')->with('column', 'integer', [ 'autoIncrement' => true, 'unsigned' => true - ]); + ])->once(); $this->table->integer('column', true, true); } @@ -140,13 +140,13 @@ public function test_small_integer() $this->dbal->shouldReceive('addColumn')->with('column', 'smallint', [ 'autoIncrement' => false, 'unsigned' => false - ]); + ])->once(); $this->table->smallInteger('column'); $this->dbal->shouldReceive('addColumn')->with('column', 'smallint', [ 'autoIncrement' => true, 'unsigned' => true - ]); + ])->once(); $this->table->smallInteger('column', true, true); } @@ -155,13 +155,13 @@ public function test_big_integer() $this->dbal->shouldReceive('addColumn')->with('column', 'bigint', [ 'autoIncrement' => false, 'unsigned' => false - ]); + ])->once(); $this->table->bigInteger('column'); $this->dbal->shouldReceive('addColumn')->with('column', 'bigint', [ 'autoIncrement' => true, 'unsigned' => true - ]); + ])->once(); $this->table->bigInteger('column', true, true); } @@ -170,7 +170,7 @@ public function test_unsigned_smallint() $this->dbal->shouldReceive('addColumn')->with('column', 'smallint', [ 'autoIncrement' => false, 'unsigned' => true - ]); + ])->once(); $this->table->unsignedSmallInteger('column'); } @@ -179,7 +179,7 @@ public function test_unsigned_integer() $this->dbal->shouldReceive('addColumn')->with('column', 'integer', [ 'autoIncrement' => false, 'unsigned' => true - ]); + ])->once(); $this->table->unsignedInteger('column'); } @@ -188,7 +188,7 @@ public function test_unsigned_bigint() $this->dbal->shouldReceive('addColumn')->with('column', 'bigint', [ 'autoIncrement' => false, 'unsigned' => true - ]); + ])->once(); $this->table->unsignedBigInteger('column'); } @@ -197,7 +197,7 @@ public function test_float() $this->dbal->shouldReceive('addColumn')->with('column', 'float', [ 'precision' => 8, 'scale' => 2 - ]); + ])->once(); $this->table->float('column'); } @@ -206,79 +206,79 @@ public function test_decimal() $this->dbal->shouldReceive('addColumn')->with('column', 'decimal', [ 'precision' => 8, 'scale' => 2 - ]); + ])->once(); $this->table->decimal('column'); } public function test_boolean() { - $this->dbal->shouldReceive('addColumn')->with('column', 'boolean'); + $this->dbal->shouldReceive('addColumn')->with('column', 'boolean')->once(); $this->table->boolean('column'); } public function test_json() { - $this->dbal->shouldReceive('addColumn')->with('column', 'json'); + $this->dbal->shouldReceive('addColumn')->with('column', 'json')->once(); $this->table->json('column'); } public function test_date() { - $this->dbal->shouldReceive('addColumn')->with('column', 'date'); + $this->dbal->shouldReceive('addColumn')->with('column', 'date')->once(); $this->table->date('column'); } public function test_dateTime() { - $this->dbal->shouldReceive('addColumn')->with('column', 'datetime'); + $this->dbal->shouldReceive('addColumn')->with('column', 'datetime')->once(); $this->table->dateTime('column'); } public function test_dateTimeTz() { - $this->dbal->shouldReceive('addColumn')->with('column', 'datetimetz'); + $this->dbal->shouldReceive('addColumn')->with('column', 'datetimetz')->once(); $this->table->dateTimeTz('column'); } public function test_timestamp() { - $this->dbal->shouldReceive('addColumn')->with('column', 'datetime'); + $this->dbal->shouldReceive('addColumn')->with('column', 'datetime')->once(); $this->table->timestamp('column'); } public function test_timestampTz() { - $this->dbal->shouldReceive('addColumn')->with('column', 'datetimetz'); + $this->dbal->shouldReceive('addColumn')->with('column', 'datetimetz')->once(); $this->table->timestampTz('column'); } public function test_nullable_timestamps() { $column = m::mock(Column::class); - $this->dbal->shouldReceive('addColumn')->with('created_at', 'datetime')->andReturn($column); - $this->dbal->shouldReceive('addColumn')->with('updated_at', 'datetime')->andReturn($column); + $this->dbal->shouldReceive('addColumn')->with('created_at', 'datetime')->andReturn($column)->once(); + $this->dbal->shouldReceive('addColumn')->with('updated_at', 'datetime')->andReturn($column)->once(); $column->shouldReceive('setNotnull')->with(false)->twice(); $this->table->nullableTimestamps(); } public function test_timestamps() { - $this->dbal->shouldReceive('addColumn')->with('created_at', 'datetime'); - $this->dbal->shouldReceive('addColumn')->with('updated_at', 'datetime'); + $this->dbal->shouldReceive('addColumn')->with('created_at', 'datetime')->once(); + $this->dbal->shouldReceive('addColumn')->with('updated_at', 'datetime')->once(); $this->table->timestamps(); } public function test_timestampsTz() { - $this->dbal->shouldReceive('addColumn')->with('created_at', 'datetimetz'); - $this->dbal->shouldReceive('addColumn')->with('updated_at', 'datetimetz'); + $this->dbal->shouldReceive('addColumn')->with('created_at', 'datetimetz')->once(); + $this->dbal->shouldReceive('addColumn')->with('updated_at', 'datetimetz')->once(); $this->table->timestampsTz(); } public function test_softdeletes() { $column = m::mock(Column::class); - $this->dbal->shouldReceive('addColumn')->with('deleted_at', 'datetime')->andReturn($column); + $this->dbal->shouldReceive('addColumn')->with('deleted_at', 'datetime')->andReturn($column)->once(); $column->shouldReceive('setNotnull')->with(false)->once(); $this->table->softDeletes(); } @@ -286,7 +286,7 @@ public function test_softdeletes() public function test_binary() { $column = m::mock(Column::class); - $this->dbal->shouldReceive('addColumn')->with('column', 'binary', ['length' => 255])->andReturn($column); + $this->dbal->shouldReceive('addColumn')->with('column', 'binary', ['length' => 255])->andReturn($column)->once(); $column->shouldReceive('setNotnull')->with(false)->once(); $this->table->binary('column'); } @@ -295,7 +295,7 @@ public function test_remember_token() { $column = m::mock(Column::class); $this->dbal->shouldReceive('addColumn')->with('remember_token', 'string', ['length' => 100]) - ->andReturn($column); + ->andReturn($column)->once(); $column->shouldReceive('setNotnull')->with(false)->once(); $this->table->rememberToken('column'); } @@ -307,7 +307,7 @@ public function test_get_dbal_table() public function test_drop_column() { - $this->dbal->shouldReceive('dropColumn')->with('column'); + $this->dbal->shouldReceive('dropColumn')->with('column')->once(); $this->table->dropColumn('column'); }