From b2339d389db66f84c223358ae80d68f718985d90 Mon Sep 17 00:00:00 2001 From: Meghdad Date: Fri, 1 May 2026 02:48:15 +0330 Subject: [PATCH] Add LazilyRefreshDatabase trait to TestCase --- tests/Feature/ChatTest.php | 3 --- tests/Feature/DashboardTest.php | 3 --- tests/Feature/Settings/ProfileUpdateTest.php | 3 --- tests/Feature/Settings/SecurityTest.php | 3 --- tests/TestCase.php | 3 +++ 5 files changed, 3 insertions(+), 12 deletions(-) diff --git a/tests/Feature/ChatTest.php b/tests/Feature/ChatTest.php index f5ffe8a..8b8b0ac 100644 --- a/tests/Feature/ChatTest.php +++ b/tests/Feature/ChatTest.php @@ -9,13 +9,10 @@ use App\Models\Conversation; use App\Models\ConversationParticipant; use App\Models\Message; use App\Models\User; -use Illuminate\Foundation\Testing\LazilyRefreshDatabase; use Illuminate\Http\UploadedFile; use Illuminate\Support\Facades\Storage; use Livewire\Livewire; -uses(LazilyRefreshDatabase::class); - test('authenticated users can visit the chat dashboard', function () { $user = User::factory()->create(); diff --git a/tests/Feature/DashboardTest.php b/tests/Feature/DashboardTest.php index 3fc46b3..95c6a8b 100644 --- a/tests/Feature/DashboardTest.php +++ b/tests/Feature/DashboardTest.php @@ -1,9 +1,6 @@ get(route('dashboard')); diff --git a/tests/Feature/Settings/ProfileUpdateTest.php b/tests/Feature/Settings/ProfileUpdateTest.php index 4c8f7c1..a3bfa01 100644 --- a/tests/Feature/Settings/ProfileUpdateTest.php +++ b/tests/Feature/Settings/ProfileUpdateTest.php @@ -2,11 +2,8 @@ use App\Livewire\Settings\Profile; use App\Models\User; -use Illuminate\Foundation\Testing\LazilyRefreshDatabase; use Livewire\Livewire; -uses(LazilyRefreshDatabase::class); - test('profile page is displayed', function () { $this->actingAs($user = User::factory()->create()); diff --git a/tests/Feature/Settings/SecurityTest.php b/tests/Feature/Settings/SecurityTest.php index dc4f230..65f30e6 100644 --- a/tests/Feature/Settings/SecurityTest.php +++ b/tests/Feature/Settings/SecurityTest.php @@ -2,13 +2,10 @@ use App\Livewire\Settings\Security; use App\Models\User; -use Illuminate\Foundation\Testing\LazilyRefreshDatabase; use Illuminate\Support\Facades\Hash; use Laravel\Fortify\Features; use Livewire\Livewire; -uses(LazilyRefreshDatabase::class); - beforeEach(function () { $this->skipUnlessFortifyHas(Features::twoFactorAuthentication()); diff --git a/tests/TestCase.php b/tests/TestCase.php index a574f37..1c9d601 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -2,11 +2,14 @@ namespace Tests; +use Illuminate\Foundation\Testing\LazilyRefreshDatabase; use Illuminate\Foundation\Testing\TestCase as BaseTestCase; use Laravel\Fortify\Features; abstract class TestCase extends BaseTestCase { + use LazilyRefreshDatabase; + protected function skipUnlessFortifyHas(string $feature, ?string $message = null): void { if (! Features::enabled($feature)) {