From 55ac483990a20beef6da6f1688d1a13dbbf3f928 Mon Sep 17 00:00:00 2001 From: CrazyBoy49z Date: Sun, 8 Sep 2024 12:37:48 +0300 Subject: [PATCH] Refactor tests to use RefreshDatabase trait Removed manual migration calls in test setup and teardown in favor of using the RefreshDatabase trait to ensure a consistent state. Corrected a typo in migration file name within the service provider. --- src/LazySettingServiceProvider.php | 2 +- tests/Pest.php | 10 ++-------- tests/TestCase.php | 6 ++---- 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/src/LazySettingServiceProvider.php b/src/LazySettingServiceProvider.php index b6c3265..8ac4a45 100644 --- a/src/LazySettingServiceProvider.php +++ b/src/LazySettingServiceProvider.php @@ -19,7 +19,7 @@ public function configurePackage(Package $package): void ->name('lazy-setting') ->hasConfigFile('lazy/setting') ->hasViews() - ->hasMigration('create_lazy-setting_table') + ->hasMigration('create_lazy_setting_table') ->hasCommand(LazySettingCommand::class); } diff --git a/tests/Pest.php b/tests/Pest.php index 38d99d9..25cd6ae 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -1,14 +1,8 @@ in(__DIR__); - -beforeEach(function () { - Artisan::call('migrate'); -}); - -afterEach(function () { - Artisan::call('migrate:reset'); -}); diff --git a/tests/TestCase.php b/tests/TestCase.php index d7a0750..6e27ada 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -24,13 +24,11 @@ protected function getPackageProviders($app) ]; } - public function getEnvironmentSetUp($app) + public function getEnvironmentSetUp($app): void { config()->set('database.default', 'testing'); - /* - $migration = include __DIR__.'/../database/migrations/create_lazy-setting_table.php.stub'; + $migration = include __DIR__.'/../database/migrations/create_lazy_setting_table.php.stub'; $migration->up(); - */ } }