diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 26572d6..5d9a780 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,34 +13,30 @@ jobs: strategy: matrix: - php: [ 8.1, 8.2 ] - laravel: [ '^10.0' ] + php: [ 8.1, 8.2, 8.3 ] + laravel: [ '10.*', '11.*' ] + exclude: + - php: 8.1 + laravel: '11.*' name: PHP ${{ matrix.php }} - LARAVEL ${{ matrix.laravel }} steps: - name: Checkout Code - uses: actions/checkout@v2 - - - name: Cache Dependencies - uses: actions/cache@v1 - with: - path: ~/.composer/cache/files - key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }} + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} - extensions: dom, libxml, mbstring, zip, pdo, sqlite, pdo_sqlite - tools: composer:v2 + extensions: dom, curl, mbstring, zip, pdo, sqlite, pdo_sqlite, iconv coverage: none - name: Install Dependencies run: | composer require "laravel/framework:${{ matrix.laravel }}" --no-interaction --no-update - composer update --prefer-dist + composer update --prefer-dist --no-interaction - name: Execute Tests run: vendor/bin/phpunit --colors=always diff --git a/bun.lockb b/bun.lockb deleted file mode 100755 index b4bbe1a..0000000 Binary files a/bun.lockb and /dev/null differ diff --git a/composer.json b/composer.json index 18b3a5d..640a6a9 100644 --- a/composer.json +++ b/composer.json @@ -6,15 +6,16 @@ "authors": [ { "name": "Supian M", - "email": "supianidz@gmail.com" + "email": "supianidz@octopy.dev" } ], "require": { - "php": "^8.1" + "php": "^8.1", + "illuminate/contracts": "^10.0|^11.0" }, "require-dev": { - "nunomaduro/collision": "^7.8", - "orchestra/testbench": "^8.11" + "nunomaduro/collision": "^7.8|^8.0", + "orchestra/testbench": "^8.11|^9.0" }, "autoload": { "psr-4": { @@ -40,7 +41,7 @@ } }, "scripts": { - "test": "vendor/bin/testbench package:test" + "test": "vendor/bin/phpunit" }, "config": { "sort-packages": true diff --git a/tests/TestCase.php b/tests/TestCase.php index 83b3a40..802d17a 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -12,11 +12,26 @@ class TestCase extends \Orchestra\Testbench\TestCase { use RefreshDatabase; + /** + * @var string + */ + protected string $database; + /** * @var Impersonate */ protected Impersonate $impersonate; + /** + * @param string $name + */ + public function __construct(string $name) + { + parent::__construct($name); + + $this->database = __DIR__ . '/../database/database.sqlite'; + } + /** * @return void */ @@ -36,11 +51,18 @@ protected function setUp() : void */ protected function defineDatabaseMigrations() : void { + if (! file_exists($this->database)) { + touch($this->database); + } + $this->artisan('migrate', ['--database' => 'testbench'])->run(); $this->loadMigrationsFrom(__DIR__ . '/../database/migrations'); $this->beforeApplicationDestroyed(function () { $this->artisan('migrate:rollback', ['--database' => 'testbench'])->run(); + if (file_exists($this->database)) { + unlink($this->database); + } }); } @@ -53,8 +75,7 @@ protected function defineEnvironment($app) : void $app['config']->set('database.default', 'testbench'); $app['config']->set('database.connections.testbench', [ 'driver' => 'sqlite', - 'database' => ':memory:', - 'prefix' => '', + 'database' => __DIR__ . '/../database/database.sqlite', ]); }