From 5d709b27cc515b609485f78362fdcb35ab7f06dc Mon Sep 17 00:00:00 2001 From: "Ralph J. Smit" <59207045+ralphjsmit@users.noreply.github.com> Date: Sat, 15 Jun 2024 16:08:58 +0200 Subject: [PATCH] test: prevent flaky test by freezing time --- tests/TestCase.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/TestCase.php b/tests/TestCase.php index 32cdbb4..817229a 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -3,6 +3,7 @@ namespace RalphJSmit\Laravel\SEO\Tests; use Illuminate\Database\Eloquent\Factories\Factory; +use Illuminate\Support\Carbon; use Illuminate\Support\Facades\Schema; use Orchestra\Testbench\TestCase as Orchestra; use RalphJSmit\Laravel\SEO\LaravelSEOServiceProvider; @@ -16,6 +17,9 @@ protected function setUp(): void Factory::guessFactoryNamesUsing( fn (string $modelName) => 'RalphJSmit\\Laravel\\SEO\\Database\\Factories\\' . class_basename($modelName) . 'Factory' ); + + // Freeze the time across entire testsuite... + Carbon::setTestNow(now()); } protected function getPackageProviders($app)