|
|
@@ -34,7 +34,7 @@ class CacheCommandsTest extends TestCase
|
|
|
public function setUp(): void
|
|
|
{
|
|
|
parent::setUp();
|
|
|
- Cache::setConfig('test', ['engine' => 'File', 'path' => CACHE]);
|
|
|
+ Cache::setConfig('test', ['engine' => 'File', 'path' => CACHE, 'groups' => ['test_group']]);
|
|
|
$this->setAppNamespace();
|
|
|
$this->useCommandRunner();
|
|
|
}
|
|
|
@@ -141,4 +141,29 @@ class CacheCommandsTest extends TestCase
|
|
|
$this->assertNull(Cache::read('key', 'test'));
|
|
|
$this->assertNull(Cache::read('key', '_cake_core_'));
|
|
|
}
|
|
|
+
|
|
|
+ public function testClearGroup(): void
|
|
|
+ {
|
|
|
+ Cache::add('key', 'value1', 'test');
|
|
|
+ $this->exec('cache clear_group test_group test');
|
|
|
+
|
|
|
+ $this->assertExitCode(Shell::CODE_SUCCESS);
|
|
|
+ $this->assertNull(Cache::read('key', 'test'));
|
|
|
+ }
|
|
|
+
|
|
|
+ public function testClearGroupInvalidConfig(): void
|
|
|
+ {
|
|
|
+ $this->exec('cache clear_group test_group does_not_exist');
|
|
|
+
|
|
|
+ $this->assertExitCode(Shell::CODE_ERROR);
|
|
|
+ $this->assertErrorContains('Cache config "does_not_exist" not found');
|
|
|
+ }
|
|
|
+
|
|
|
+ public function testClearInvalidGroup(): void
|
|
|
+ {
|
|
|
+ $this->exec('cache clear_group does_not_exist');
|
|
|
+
|
|
|
+ $this->assertExitCode(Shell::CODE_ERROR);
|
|
|
+ $this->assertErrorContains('Cache group "does_not_exist" not found');
|
|
|
+ }
|
|
|
}
|