Skip to content

Commit 2aafdaf

Browse files
authored
Merge branch 'master' into expiresAfter
2 parents cfaa228 + dfe6681 commit 2aafdaf

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/CachePoolTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -876,4 +876,21 @@ public function testSavingObject()
876876
$value = $item->get();
877877
$this->assertInstanceOf('DateTime', $value, 'You must be able to store objects in cache.');
878878
}
879+
880+
public function testHasItemReturnsFalseWhenDeferredItemIsExpired()
881+
{
882+
if (isset($this->skippedTests[__FUNCTION__])) {
883+
$this->markTestSkipped($this->skippedTests[__FUNCTION__]);
884+
885+
return;
886+
}
887+
888+
$item = $this->cache->getItem('key');
889+
$item->set('value');
890+
$item->expiresAfter(2);
891+
$this->cache->saveDeferred($item);
892+
893+
sleep(3);
894+
$this->assertFalse($this->cache->hasItem('key'));
895+
}
879896
}

0 commit comments

Comments
 (0)