Skip to content

Commit 8a41491

Browse files
authored
Fix flaky test by freezing time before increment operation (#57905)
This prevents timing race conditions where time can advance between when the cache value is incremented (which records a timestamp) and when subsequent time-based checks occur, causing intermittent test failures.
1 parent 49c39b6 commit 8a41491

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

tests/Cache/CacheArrayStoreTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ public function testIncrementNonNumericValues()
117117

118118
public function testNonExistingKeysCanBeIncremented()
119119
{
120+
Carbon::setTestNow(Carbon::now());
121+
120122
$store = new ArrayStore;
121123
$result = $store->increment('foo');
122124
$this->assertEquals(1, $result);

0 commit comments

Comments
 (0)