Skip to content

Commit b0a2eef

Browse files
authored
Fix flaky test by freezing time before write operation (#57902)
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 c422db9 commit b0a2eef

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
@@ -59,6 +59,7 @@ public function test_it_reads_data_from_an_expired_session()
5959
{
6060
$handler = new ArraySessionHandler(10);
6161

62+
Carbon::setTestNow(Carbon::now());
6263
$handler->write('foo', 'bar');
6364

6465
Carbon::setTestNow(Carbon::now()->addMinutes(10)->addSecond());

0 commit comments

Comments
 (0)