test: centralize test configuration and add more guards to pest config

This commit is contained in:
peaklabs-dev committed 2026-03-23 21:13:04 +01:00
1 parent c42305cda6
commit 6de4e70eb8
2 files changed
+15 -13

No files matched your search

-12
View File
@@ -43,7 +43,6 @@ final class AppServiceProvider extends ServiceProvider
$this->configureModels();
$this->configureDates();
$this->configureQueues();
$this->configureTests();
$this->configureRequestExceptions();
$this->configureVite();
}
@@ -116,17 +115,6 @@ final class AppServiceProvider extends ServiceProvider
Queue::withoutInterruptionPolling();
}
/**
* Configure tests.
*/
private function configureTests(): void
{
if (App::runningUnitTests()) {
Sleep::fake();
Http::preventStrayRequests();
}
}
/**
* Configure request exceptions.
*/
+15 -1
View File
@@ -3,6 +3,10 @@
declare(strict_types=1);
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Process;
use Illuminate\Support\Sleep;
use Illuminate\Support\Str;
use Tests\TestCase;
/*
@@ -17,7 +21,17 @@ use Tests\TestCase;
*/
pest()->extend(TestCase::class)
->use(RefreshDatabase::class);
->use(RefreshDatabase::class)
->beforeEach(function (): void {
Str::createRandomStringsNormally();
Str::createUuidsNormally();
Str::createUlidsNormally();
Http::preventStrayRequests();
Process::preventStrayProcesses();
Sleep::fake();
$this->freezeTime();
});
/*
|--------------------------------------------------------------------------