Skip to content

Commit eec38a0

Browse files
minor symfony#53303 [Cache] harden cache expiration test (xabbuh)
This PR was merged into the 5.4 branch. Discussion ---------- [Cache] harden cache expiration test | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | | License | MIT In the worst case when the process sleeps for exactly one second the current timestamp would be exactly the same as the expiration time. Increasing the sleep time ensures that the tested item is always expired when executing the test. Commits ------- 232dfb7 harden cache expiration test
2 parents 9c6d698 + 232dfb7 commit eec38a0

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/Symfony/Component/Cache/Tests/Adapter/ProxyAdapterAndRedisAdapterTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ static function (CacheItem $item, $expiry) {
6666
$this->assertSame($value, $this->cache->getItem('baz')->get());
6767

6868
sleep(1);
69+
usleep(100000);
6970
$this->assertSame($value, $this->cache->getItem('foo')->get());
7071
$this->assertSame($value, $this->cache->getItem('bar')->get());
7172
$this->assertFalse($this->cache->getItem('baz')->isHit());

0 commit comments

Comments
 (0)