From 674fe7db086b74860f9ba78bac03308d977d8a02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vi=CC=81ctor=20Falco=CC=81n?= Date: Fri, 3 Jul 2026 09:00:25 +0200 Subject: [PATCH] test(drip): freeze time to deflake the AI consent onboarding-grace boundary The two now() calls in userWithConsent() are evaluated microseconds apart, so accepted_at lands just after created_at + grace, tipping the exactly-3-days boundary case over and dispatching a job the test asserts against. Freezing time makes the day-relative timestamps land on exact boundaries. --- tests/Feature/SendAiConsentFollowUpEmailsCommandTest.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/Feature/SendAiConsentFollowUpEmailsCommandTest.php b/tests/Feature/SendAiConsentFollowUpEmailsCommandTest.php index a1539541..568c342b 100644 --- a/tests/Feature/SendAiConsentFollowUpEmailsCommandTest.php +++ b/tests/Feature/SendAiConsentFollowUpEmailsCommandTest.php @@ -9,6 +9,10 @@ use App\Models\UserMailLog; use Illuminate\Support\Facades\Bus; use Illuminate\Support\Facades\Mail; +// Freeze time so day-relative timestamps land on exact boundaries; without this the +// two now() calls below drift by microseconds and tip the "exactly 3 days" case over. +beforeEach(fn () => $this->freezeTime()); + /** * Creates a user whose AI consent was recorded $acceptedDaysAgo days ago, having * signed up $signedUpDaysAgo days ago.