diff --git a/.gitattributes b/.gitattributes index ec3577d888a..1eddc24b69c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3,4 +3,5 @@ /.github export-ignore /.gitignore export-ignore /phpunit.xml.dist export-ignore +/testbench.yaml export-ignore /tests export-ignore diff --git a/composer.json b/composer.json index 789923a75e0..4787fd5745d 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ "league/flysystem-aws-s3-v3": "^3.0", "nunomaduro/termwind": "^1.0|^2.0", "openspout/openspout": "^4.23", - "orchestra/testbench": "^8.0|^9.0", + "orchestra/testbench": "^8.20|^9.0", "pestphp/pest": "^2.0", "pestphp/pest-plugin-laravel": "^2.0", "phpstan/extension-installer": "^1.1", diff --git a/testbench.yaml b/testbench.yaml new file mode 100644 index 00000000000..c2aa11f93bb --- /dev/null +++ b/testbench.yaml @@ -0,0 +1,5 @@ +migrations: + - tests/database/migrations + +workbench: + install: true diff --git a/tests/database/migrations/create_password_reset_tokens_table.php b/tests/database/migrations/create_password_reset_tokens_table.php deleted file mode 100644 index bce2f339eea..00000000000 --- a/tests/database/migrations/create_password_reset_tokens_table.php +++ /dev/null @@ -1,22 +0,0 @@ -string('email')->index(); - $table->string('token'); - $table->timestamp('created_at')->nullable(); - }); - } - - public function down(): void - { - Schema::dropIfExists('password_reset_tokens'); - } -}; diff --git a/tests/database/migrations/create_users_table.php b/tests/database/migrations/create_users_table.php deleted file mode 100644 index 2bf418036fa..00000000000 --- a/tests/database/migrations/create_users_table.php +++ /dev/null @@ -1,26 +0,0 @@ -id(); - $table->string('name'); - $table->string('email')->unique(); - $table->timestamp('email_verified_at')->nullable(); - $table->string('password'); - $table->rememberToken(); - $table->timestamps(); - }); - } - - public function down(): void - { - Schema::dropIfExists('users'); - } -}; diff --git a/tests/src/TestCase.php b/tests/src/TestCase.php index 05f6e167eeb..8cefc56327c 100644 --- a/tests/src/TestCase.php +++ b/tests/src/TestCase.php @@ -17,12 +17,14 @@ use Filament\Widgets\WidgetsServiceProvider; use Illuminate\Foundation\Testing\LazilyRefreshDatabase; use Livewire\LivewireServiceProvider; +use Orchestra\Testbench\Concerns\WithWorkbench; use Orchestra\Testbench\TestCase as BaseTestCase; use RyanChandler\BladeCaptureDirective\BladeCaptureDirectiveServiceProvider; abstract class TestCase extends BaseTestCase { use LazilyRefreshDatabase; + use WithWorkbench; protected function getPackageProviders($app): array { @@ -49,14 +51,8 @@ protected function getPackageProviders($app): array ]; } - protected function defineDatabaseMigrations(): void + protected function defineEnvironment($app): void { - $this->loadMigrationsFrom(__DIR__ . '/../database/migrations'); - } - - protected function getEnvironmentSetUp($app): void - { - $app['config']->set('auth.passwords.users.table', 'password_reset_tokens'); $app['config']->set('auth.providers.users.model', User::class); $app['config']->set('view.paths', [ ...$app['config']->get('view.paths'),