diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index df5c7de..d8d9009 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,10 +19,10 @@ on: - unassigned env: - php_extensions: 'apcu, bcmath, ctype, curl, dom, iconv, intl, json, mbstring, opcache, openssl, pdo, pdo_pgsql, pcntl, pcov, posix, redis, session, simplexml, sockets, tokenizer, xml, xmlwriter, zip' + php_extensions: 'apcu, bcmath, ctype, curl, dom, iconv, intl, json, mbstring, opcache, openssl, pdo, pdo_pgsql, pcntl, pcov, posix, redis, session, simplexml, sockets, tokenizer, xml, xmlwriter, zip, xdebug' key: cache-v0.1 DB_USER: 'postgres' - DB_NAME: 'testing' + DB_NAME: 'postgres' DB_PASSWORD: 'postgres' DB_HOST: '127.0.0.1' @@ -33,11 +33,11 @@ jobs: strategy: matrix: operating_system: [ubuntu-latest] - php_versions: ['7.4'] + php_versions: ['8.3'] fail-fast: false env: PHP_CS_FIXER_FUTURE_MODE: '0' - name: 'Lint PHP' + name: 'Linter PHP' steps: - name: 'Checkout' uses: actions/checkout@v2 @@ -75,48 +75,18 @@ jobs: strategy: fail-fast: false matrix: - coverage: [false] + coverage: [true] experimental: [false] operating_system: [ubuntu-latest] - postgres: ['9.6'] - laravel: ['^6.0'] - php_versions: ['7.4'] + postgres: ['11', '12', '13', '14', '15'] + laravel: ['^11.0'] + php_versions: ['8.3'] include: - operating_system: ubuntu-latest - postgres: '10' - php_versions: '7.4' - laravel: '^7.0' - experimental: false - coverage: true - - operating_system: ubuntu-latest - postgres: '11' - php_versions: '7.4' - laravel: '^8.0' - experimental: false - coverage: true - - operating_system: ubuntu-latest - postgres: '12' - php_versions: '8.0' - laravel: '^8.0' - experimental: false - coverage: true - - operating_system: ubuntu-latest - postgres: '13' - php_versions: '8.0' - laravel: '^9.0' - experimental: false - coverage: false - - operating_system: ubuntu-latest - postgres: '14' - php_versions: '8.1' - laravel: '^10.0' - experimental: false - coverage: false - - operating_system: ubuntu-latest - postgres: '15' - php_versions: '8.2' + postgres: '16' + php_versions: '8.4' laravel: '^11.0' - experimental: false + experimental: true coverage: false runs-on: '${{ matrix.operating_system }}' services: @@ -130,7 +100,7 @@ jobs: - 5432:5432 # needed because the postgres container does not provide a healthcheck options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 - name: 'Test / Laravel ${{ matrix.laravel }} / PHP ${{ matrix.php_versions }} / Postgres ${{ matrix.postgres }}' + name: 'Testing / Laravel ${{ matrix.laravel }} / PHP ${{ matrix.php_versions }} / Postgres ${{ matrix.postgres }}' needs: - lint steps: @@ -160,10 +130,11 @@ jobs: with: php-version: ${{ matrix.php_versions }} extensions: ${{ env.php_extensions }} - ini-values: 'pcov.directory=src, date.timezone=UTC, upload_max_filesize=20M, post_max_size=20M, memory_limit=512M, short_open_tag=Off' - coverage: pcov + ini-values: 'pcov.directory=src, date.timezone=UTC, upload_max_filesize=20M, post_max_size=20M, memory_limit=512M, short_open_tag=Off, xdebug.mode="develop,coverage"' + coverage: xdebug tools: 'phpunit' - name: 'Install PHP dependencies with Composer' + continue-on-error: ${{ matrix.experimental }} run: | composer require "laravel/framework=${{ matrix.laravel }}" --no-update COMPOSER_MEMORY_LIMIT=-1 composer install --prefer-dist --no-progress --no-suggest --optimize-autoloader @@ -192,6 +163,7 @@ jobs: -e "s/\${DATABASE}/${{ env.DB_NAME }}/" \ -e "s/\${HOST}/${{ env.DB_HOST }}/" \ phpunit.xml.dist > phpunit.xml + ./vendor/bin/phpunit -c phpunit.xml --migrate-configuration if [[ ${{ matrix.coverage }} == true ]]; then ./vendor/bin/phpunit --stderr --coverage-clover build/logs/clover.xml --coverage-text else diff --git a/composer.json b/composer.json index dff89ca..98b42bc 100644 --- a/composer.json +++ b/composer.json @@ -35,19 +35,18 @@ } }, "require": { - "php": "^7.3|^7.4|^8.0|^8.1|^8.2", - "illuminate/support": "^5.7|^6.20|^7.30|^8.20|^9.0|^10.0|^11.0", - "illuminate/database": "^5.7|^6.20|^7.30|^8.20|^9.0|^10.0|^11.0", - "illuminate/console": "^5.7|^6.20|^7.30|^8.20|^9.0|^10.0|^11.0" + "php": "^8.3|^8.4", + "illuminate/support": "^11.0", + "illuminate/database": "^11.0", + "illuminate/console": "^11.0" }, "require-dev": { - "phpunit/phpunit": "^7.3|^8.5|^9.4|^10.0|^11.0", + "phpunit/phpunit": "^11.0", "php-mock/php-mock": "^2.0", - "orchestra/testbench": "^3.8|^4.8|^5.7|^6.2|^7.0|^8.0|^9.0", - "umbrellio/code-style-php": "^1.0", + "orchestra/testbench": "^9.0", + "umbrellio/code-style-php": "^1.2", "laravel/legacy-factories": "^1.0", - "php-coveralls/php-coveralls": "^2.1", - "squizlabs/php_codesniffer": "^3.5" + "php-coveralls/php-coveralls": "^2.7" }, "scripts": { "lint": "vendor/bin/ecs check src --config=ecs.php", diff --git a/phpunit.xml.bak b/phpunit.xml.bak new file mode 100644 index 0000000..770152e --- /dev/null +++ b/phpunit.xml.bak @@ -0,0 +1,31 @@ + + + + + ./src + + + ./src/Console/RollbackNewMigrations.php + + + + + + + + + + + + + + + ./tests + + + diff --git a/tests.sh b/tests.sh index a9f3f0c..bbf9baa 100755 --- a/tests.sh +++ b/tests.sh @@ -9,8 +9,8 @@ sed -e "s/\${USERNAME}/postgres/" \ -e "s/\${DATABASE}/testing/" \ -e "s/\${HOST}/127.0.0.1/" \ .env.sample > .env -sed -e "s/\${LARAVEL_VERSION}/^8.0/" \ - -e "s/\${PHP_VERSION}/8.0.11/" \ +sed -e "s/\${LARAVEL_VERSION}/^11.0/" \ + -e "s/\${PHP_VERSION}/8.3.6/" \ composer.json.sample > composer.json rm -rf release composer create-project laravel/laravel release @@ -29,4 +29,5 @@ sed -e "s/\${USERNAME}/postgres/" \ -e "s/\${DATABASE}/testing/" \ -e "s/\${HOST}/127.0.0.1/" \ phpunit.xml.dist > phpunit.xml -php -d pcov.directory='.' vendor/bin/phpunit --coverage-html build --coverage-text +php vendor/bin/phpunit -c phpunit.xml --migrate-configuration +php -d xdebug.mode=coverage -d memory_limit=-1 vendor/bin/phpunit --coverage-html build --coverage-text diff --git a/tests/functional/Console/RollbackMissingMigrationsTest.php b/tests/functional/Console/RollbackMissingMigrationsTest.php index 4aa5dbf..b07c92c 100644 --- a/tests/functional/Console/RollbackMissingMigrationsTest.php +++ b/tests/functional/Console/RollbackMissingMigrationsTest.php @@ -7,6 +7,8 @@ use Generator; use Illuminate\Support\Facades\Artisan; use Illuminate\Support\Facades\DB; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Test; use Umbrellio\Deploy\Exceptions\RollbackMissingMigrationException; use Umbrellio\Deploy\RollbackMissingMigrationServiceProvider; use Umbrellio\Deploy\Tests\FunctionalTestCase; @@ -35,10 +37,8 @@ public static function provideMigrations(): Generator ]; } - /** - * @test - * @dataProvider provideMigrations - */ + #[Test] + #[DataProvider('provideMigrations')] public function rollbackSuccessful(array $before, array $after): void { $this->assertSame($before, $this->getMigrations()); @@ -46,10 +46,8 @@ public function rollbackSuccessful(array $before, array $after): void $this->assertSame($after, $this->getMigrations()); } - /** - * @test - * @dataProvider provideMigrations - */ + #[Test] + #[DataProvider('provideMigrations')] public function nothingToRollback(array $before, array $after): void { $this->assertSame($before, $this->getMigrations()); @@ -57,9 +55,7 @@ public function nothingToRollback(array $before, array $after): void $this->assertSame($before, $this->getMigrations()); } - /** - * @test - */ + #[Test] public function rollbackFail(): void { $this->expectException(RollbackMissingMigrationException::class); diff --git a/tests/unit/.gitkeep b/tests/unit/.gitkeep deleted file mode 100644 index e69de29..0000000