Use Testbench configuration feature

This commit is contained in:
Mior Muhammad Zaki
2024-02-27 13:57:55 +00:00
parent 060dd04f65
commit fec755359f
4 changed files with 8 additions and 54 deletions
+5
View File
@@ -0,0 +1,5 @@
migrations:
- tests/database/migrations
workbench:
install: true
@@ -1,22 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class() extends Migration
{
public function up(): void
{
Schema::create('password_reset_tokens', function (Blueprint $table): void {
$table->string('email')->index();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
}
public function down(): void
{
Schema::dropIfExists('password_reset_tokens');
}
};
@@ -1,26 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class() extends Migration
{
public function up(): void
{
Schema::create('users', function (Blueprint $table): void {
$table->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');
}
};
+3 -6
View File
@@ -17,12 +17,14 @@ use Filament\Tests\Models\User;
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,12 +51,7 @@ abstract class TestCase extends BaseTestCase
];
}
protected function defineDatabaseMigrations(): void
{
$this->loadMigrationsFrom(__DIR__ . '/../database/migrations');
}
protected function getEnvironmentSetUp($app): void
protected function defineEnvironment($app): void
{
$app['config']->set('auth.passwords.users.table', 'password_reset_tokens');
$app['config']->set('auth.providers.users.model', User::class);