diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 8e311fb..7d7939c 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -2,9 +2,11 @@ name: run-tests on: push: - branches: [main] + branches: + - main pull_request: - branches: [main] + branches: + - main jobs: test: @@ -13,23 +15,17 @@ jobs: fail-fast: true matrix: os: [ubuntu-latest, windows-latest] - php: [8.2, 8.1, 8.0] - laravel: [10.*, 9.*, 8.*] + php: [8.1, 8.2, 8.3] + laravel: ["10.*", "11.*"] stability: [prefer-lowest, prefer-stable] include: - laravel: 10.* testbench: ^8.0 - - laravel: 9.* - testbench: ^7.0.0 - - laravel: 8.* - testbench: ^6.23 + - laravel: 11.* + testbench: ^9.0 exclude: - - laravel: 8.* - php: 8.2 - - laravel: 9.* - php: 8.2 - - laravel: 10.* - php: 8.0 + - laravel: 11.* + php: 8.1 name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} diff --git a/composer.json b/composer.json index 368fe40..2bf152c 100644 --- a/composer.json +++ b/composer.json @@ -16,18 +16,17 @@ } ], "require": { - "php": "^8.0", - "coderflexx/laravel-presenter": "^1.1", - "illuminate/contracts": "^8.0|^9.0|^10.0", + "php": "^8.1", + "coderflexx/laravel-presenter": "^2.0", + "illuminate/contracts": "^10.0|^11.0", "jaybizzle/crawler-detect": "^1.2", "spatie/laravel-package-tools": "^1.9.2" }, "require-dev": { - "nunomaduro/collision": "^5.10|^6.1|^7.0", + "nunomaduro/collision": "^7.0|^8.0", "nunomaduro/larastan": "^1.0|^2.0", - "orchestra/testbench": "^6.23|^7.0.0|^8.0", - "pestphp/pest": "^1.22", - "pestphp/pest-plugin-laravel": "^1.1", + "orchestra/testbench": "^8.0|^9.0", + "pestphp/pest": "^1.22|^2.34", "phpstan/extension-installer": "^1.1", "phpstan/phpstan-deprecation-rules": "^1.0", "phpstan/phpstan-phpunit": "^1.0", diff --git a/tests/Pest.php b/tests/Pest.php index 305b357..10fcc78 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -1,7 +1,7 @@ in(__DIR__); +uses(TestCase::class)->in(__DIR__); + +beforeEach()->setupDatabases(); diff --git a/tests/TestCase.php b/tests/TestCase.php index 1500bc4..c66348a 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -4,14 +4,17 @@ use Coderflex\Laravisit\LaravisitServiceProvider; use Illuminate\Database\Eloquent\Factories\Factory; +use Illuminate\Support\Facades\Schema; use Orchestra\Testbench\TestCase as Orchestra; -class TestCase extends Orchestra +abstract class TestCase extends Orchestra { protected function setUp(): void { parent::setUp(); + $this->setupDatabases($this->app); + Factory::guessFactoryNamesUsing( fn (string $modelName) => 'Coderflex\\Laravisit\\Database\\Factories\\'.class_basename($modelName).'Factory' ); @@ -24,7 +27,7 @@ protected function getPackageProviders($app) ]; } - public function getEnvironmentSetUp($app) + public function setupDatabases($app) { config()->set('database.default', 'sqlite'); config()->set('database.connections.sqlite', [ @@ -32,6 +35,7 @@ public function getEnvironmentSetUp($app) 'database' => ':memory:', ]); + Schema::dropAllTables(); // load laravisits migration $migration = include __DIR__ . '/../database/migrations/create_laravisits_table.php.stub';