Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions src/CachePoolTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand All @@ -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');
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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.");
Expand Down