Conditions | 1 |
Paths | 1 |
Total Lines | 23 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
17 | public function testMemory() |
||
18 | { |
||
19 | $cache = new ArrayCache(); |
||
|
|||
20 | $fileBoundCache = new FileBoundCache($cache, 'prefix'); |
||
21 | $adapter = new FileBoundMemoryAdapter($fileBoundCache); |
||
22 | |||
23 | $tmpPath = sys_get_temp_dir().'/tmpCacheTest'; |
||
24 | touch($tmpPath); |
||
25 | |||
26 | $adapter->set('foo', 'bar', [ |
||
27 | $tmpPath |
||
28 | ]); |
||
29 | |||
30 | $this->assertSame('bar', $adapter->get('foo')); |
||
31 | |||
32 | $adapter2 = new FileBoundMemoryAdapter($fileBoundCache); |
||
33 | $this->assertSame('bar', $adapter2->get('foo')); |
||
34 | |||
35 | sleep(1); |
||
36 | clearstatcache($tmpPath); |
||
37 | touch($tmpPath); |
||
38 | |||
39 | $this->assertSame('bar', $adapter->get('foo')); |
||
40 | } |
||
42 |