Skip to content

Commit 5d709b2

Browse files
committed
test: prevent flaky test by freezing time
1 parent fdd7713 commit 5d709b2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tests/TestCase.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace RalphJSmit\Laravel\SEO\Tests;
44

55
use Illuminate\Database\Eloquent\Factories\Factory;
6+
use Illuminate\Support\Carbon;
67
use Illuminate\Support\Facades\Schema;
78
use Orchestra\Testbench\TestCase as Orchestra;
89
use RalphJSmit\Laravel\SEO\LaravelSEOServiceProvider;
@@ -16,6 +17,9 @@ protected function setUp(): void
1617
Factory::guessFactoryNamesUsing(
1718
fn (string $modelName) => 'RalphJSmit\\Laravel\\SEO\\Database\\Factories\\' . class_basename($modelName) . 'Factory'
1819
);
20+
21+
// Freeze the time across entire testsuite...
22+
Carbon::setTestNow(now());
1923
}
2024

2125
protected function getPackageProviders($app)

0 commit comments

Comments
 (0)