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.
This commit is contained in:
Víctor Falcón 2026-07-03 09:00:25 +02:00
parent 3d3f6daa77
commit 674fe7db08
1 changed files with 4 additions and 0 deletions

View File

@ -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.