|
|
@@ -54,6 +54,8 @@ class FileEngineTest extends CakeTestCase {
|
|
|
Cache::clear(false, 'file_test');
|
|
|
Cache::drop('file_test');
|
|
|
Cache::drop('file_groups');
|
|
|
+ Cache::drop('file_groups2');
|
|
|
+ Cache::drop('file_groups3');
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -422,4 +424,32 @@ class FileEngineTest extends CakeTestCase {
|
|
|
$this->assertFalse(Cache::read('test_groups', 'file_groups'));
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * Test clearing a cache group
|
|
|
+ *
|
|
|
+ * @return void
|
|
|
+ **/
|
|
|
+ public function testGroupClear() {
|
|
|
+ Cache::config('file_groups', array('engine' => 'File', 'duration' => 3600, 'groups' => array('group_a', 'group_b')));
|
|
|
+ Cache::config('file_groups2', array('engine' => 'File', 'duration' => 3600, 'groups' => array('group_b')));
|
|
|
+ Cache::config('file_groups3', array('engine' => 'File', 'duration' => 3600, 'groups' => array('group_a')));
|
|
|
+
|
|
|
+ $this->assertTrue(Cache::write('test_groups', 'value', 'file_groups'));
|
|
|
+ $this->assertTrue(Cache::write('test_groups2', 'value', 'file_groups2'));
|
|
|
+ $this->assertTrue(Cache::write('test_groups3', 'value', 'file_groups3'));
|
|
|
+
|
|
|
+ $this->assertTrue(Cache::clearGroup('group_a', 'file_groups'));
|
|
|
+ $this->assertFalse(Cache::read('test_groups', 'file_groups'));
|
|
|
+ $this->assertEquals('value', Cache::read('test_groups2', 'file_groups2'));
|
|
|
+ $this->assertFalse(Cache::read('test_groups3', 'file_groups3'));
|
|
|
+
|
|
|
+ $this->assertTrue(Cache::write('test_groups4', 'value', 'file_groups'));
|
|
|
+ $this->assertTrue(Cache::write('test_groups5', 'value', 'file_groups2'));
|
|
|
+ $this->assertTrue(Cache::write('test_groups6', 'value', 'file_groups3'));
|
|
|
+
|
|
|
+ $this->assertTrue(Cache::clearGroup('group_b', 'file_groups'));
|
|
|
+ $this->assertFalse(Cache::read('test_groups4', 'file_groups'));
|
|
|
+ $this->assertFalse(Cache::read('test_groups5', 'file_groups2'));
|
|
|
+ $this->assertEquals('value', Cache::read('test_groups6', 'file_groups3'));
|
|
|
+ }
|
|
|
}
|