diff options
author | Robin Appelman <icewind@owncloud.com> | 2012-07-22 02:31:43 +0200 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2012-07-22 02:31:48 +0200 |
commit | 51566e87c7343385ae3b6854386c20974c94a53d (patch) | |
tree | 35b50a0cf64ed280f037902a87504d2af3a92428 /tests | |
parent | 2b747789588e34bce24bd558f7e979a6e0ea8047 (diff) | |
download | nextcloud-server-51566e87c7343385ae3b6854386c20974c94a53d.tar.gz nextcloud-server-51566e87c7343385ae3b6854386c20974c94a53d.zip |
add prefix option to OC_Cache::clear
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/cache.php | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/lib/cache.php b/tests/lib/cache.php index bb5cfc6ee19..511999be956 100644 --- a/tests/lib/cache.php +++ b/tests/lib/cache.php @@ -42,6 +42,27 @@ abstract class Test_Cache extends UnitTestCase { $this->assertNull($this->instance->get('not_set'),'Unset value not equal to null'); $this->assertTrue($this->instance->remove('value1')); + $this->assertFalse($this->instance->hasKey('value1')); + } + + function testClear(){ + $value='ipsum lorum'; + $this->instance->set('1_value1',$value); + $this->instance->set('1_value2',$value); + $this->instance->set('2_value1',$value); + $this->instance->set('3_value1',$value); + + $this->assertTrue($this->instance->clear('1_')); + $this->assertFalse($this->instance->hasKey('1_value1')); + $this->assertFalse($this->instance->hasKey('1_value2')); + $this->assertTrue($this->instance->hasKey('2_value1')); + $this->assertTrue($this->instance->hasKey('3_value1')); + + $this->assertTrue($this->instance->clear()); + $this->assertFalse($this->instance->hasKey('1_value1')); + $this->assertFalse($this->instance->hasKey('1_value2')); + $this->assertFalse($this->instance->hasKey('2_value1')); + $this->assertFalse($this->instance->hasKey('3_value1')); } function testTTL(){ |