]> source.dussan.org Git - nextcloud-server.git/commitdiff
add TTL tests for OC_Cache
authorRobin Appelman <icewind@owncloud.com>
Tue, 5 Jun 2012 18:59:52 +0000 (20:59 +0200)
committerRobin Appelman <icewind@owncloud.com>
Tue, 5 Jun 2012 18:59:52 +0000 (20:59 +0200)
tests/lib/cache.php

index 23cbd3506eb56400ff4461486cb04be84b0683f8..fdc39aec184732984c3319ad61fbcc7f4cfcebe7 100644 (file)
@@ -43,5 +43,14 @@ abstract class Test_Cache extends UnitTestCase {
        }
 
        function testTTL(){
+               $value='foobar';
+               $this->instance->set('value1',$value,1);
+               $value2='foobar';
+               $this->instance->set('value2',$value2);
+               sleep(2);
+               $this->assertFalse($this->instance->hasKey('value1'));
+               $this->assertNull($this->instance->get('value1'));
+               $this->assertTrue($this->instance->hasKey('value2'));
+               $this->assertEqual($value2,$this->instance->get('value2'));
        }
 }
\ No newline at end of file