From efab3d22dac28b6bd210915ec72fde61d201941c Mon Sep 17 00:00:00 2001 From: sumaiazaman Date: Tue, 25 Nov 2025 11:00:20 +0600 Subject: [PATCH] Fix flaky test by freezing time before write operation This prevents timing race conditions where time can advance between when the session is written (which records a timestamp) and when the garbage collection check occurs, causing intermittent test failures. --- tests/Session/ArraySessionHandlerTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/Session/ArraySessionHandlerTest.php b/tests/Session/ArraySessionHandlerTest.php index e6d29714c31e..8511c56b02cf 100644 --- a/tests/Session/ArraySessionHandlerTest.php +++ b/tests/Session/ArraySessionHandlerTest.php @@ -100,6 +100,7 @@ public function test_it_cleans_up_old_sessions() $this->assertSame(0, $handler->gc(300)); + Carbon::setTestNow(Carbon::now()); $handler->write('foo', 'bar'); $this->assertSame(0, $handler->gc(300)); $this->assertSame('bar', $handler->read('foo'));