Skip to content

Commit 463673d

Browse files
committed
Add test for checking ttl
1 parent c7734bf commit 463673d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tests/CacheTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@ public function it_stores_and_retrieves_values(): void
2424
$this->assertPromiseFulfillsWith($this->cache->get('key'), 'test');
2525
}
2626

27+
/** @test */
28+
public function it_stores_values_with_ttl(): void
29+
{
30+
$this->waitForPromise($this->cache->set('key', 'test', 1));
31+
32+
sleep(1);
33+
34+
$this->assertPromiseRejectsWith($this->cache->get('key'), Exception::class);
35+
}
36+
2737
/** @test */
2838
public function it_rejects_promise_when_retrieving_non_existing_key(): void
2939
{

0 commit comments

Comments
 (0)