diff --git a/src/CachePoolTest.php b/src/CachePoolTest.php index 0cdaa17..9b2f9f1 100644 --- a/src/CachePoolTest.php +++ b/src/CachePoolTest.php @@ -344,8 +344,7 @@ public function testSaveExpired() $item = $this->cache->getItem('key'); $item->set('value'); $item->expiresAt(\DateTime::createFromFormat('U', time())); - sleep(1); - $this->cache->save($item); + $this->assertFalse($this->cache->save($item), 'Cache should not save expired items'); $item = $this->cache->getItem('key'); $this->assertFalse($item->isHit(), 'Cache should not save expired items'); } @@ -362,8 +361,6 @@ public function testSaveWithoutExpire() $item->set('data'); $this->cache->save($item); - sleep(1); - // Use a new pool instance to ensure that we don't it any caches $pool = $this->createCachePool(); $item = $pool->getItem('test_ttl_null'); @@ -412,8 +409,7 @@ public function testDeferredExpired() $item = $this->cache->getItem('key'); $item->set('4711'); $item->expiresAt(\DateTime::createFromFormat('U', time())); - $return = $this->cache->saveDeferred($item); - sleep(1); + $this->assertFalse($this->cache->saveDeferred($item)); $this->assertFalse($this->cache->hasItem('key'), 'Cache should not have expired deferred item'); $this->cache->commit(); @@ -492,11 +488,10 @@ public function testExpiration() $item = $this->cache->getItem('key'); $item->set('value'); - // Expire after 2 seconds $item->expiresAfter(2); $this->cache->save($item); - sleep(4); + sleep(2); $item = $this->cache->getItem('key'); $this->assertFalse($item->isHit()); $this->assertNull($item->get(), "Item's value must be null when isHit() is false.");