Skip to content

Commit c422db9

Browse files
authored
Fix flaky test by freezing time before write operation (#57903)
This prevents timing race conditions where time can advance between when the session is written (which records a timestamp) and when the expiration check occurs, causing intermittent test failures.
1 parent 6ec8614 commit c422db9

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

tests/Session/ArraySessionHandlerTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public function test_it_reads_data_from_an_almost_expired_session()
4848
{
4949
$handler = new ArraySessionHandler(10);
5050

51+
Carbon::setTestNow(Carbon::now());
5152
$handler->write('foo', 'bar');
5253

5354
Carbon::setTestNow(Carbon::now()->addMinutes(10));

0 commit comments

Comments
 (0)