mirror of
https://github.com/friendica/friendica
synced 2025-04-22 14:30:12 +00:00
friendica-5847 Console Cache List command doesn't work
- Added $prefix to all CacheDriver - Moved hostname magic to CacheDriver - Added test for getAllKeys()
This commit is contained in:
parent
1551570b7f
commit
3f0f3b6ae6
15 changed files with 131 additions and 48 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Friendica\Test\src\Core\Cache;
|
||||
|
||||
use Friendica\Core\Cache\MemcachedCacheDriver;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Test\DatabaseTest;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
|
@ -13,6 +14,12 @@ abstract class CacheTest extends DatabaseTest
|
|||
*/
|
||||
protected $instance;
|
||||
|
||||
/**
|
||||
* @var \Friendica\Core\Cache\IMemoryCacheDriver
|
||||
*/
|
||||
protected $cache;
|
||||
|
||||
|
||||
abstract protected function getInstance();
|
||||
|
||||
protected function setUp()
|
||||
|
@ -29,6 +36,8 @@ abstract class CacheTest extends DatabaseTest
|
|||
Config::set('system', 'throttle_limit_week', 100);
|
||||
Config::set('system', 'throttle_limit_month', 100);
|
||||
Config::set('system', 'theme', 'system_theme');
|
||||
|
||||
$this->instance->clear(false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -177,4 +186,27 @@ abstract class CacheTest extends DatabaseTest
|
|||
$received = $this->instance->get('objVal');
|
||||
$this->assertEquals($value, $received, 'Value type changed from ' . gettype($value) . ' to ' . gettype($received));
|
||||
}
|
||||
|
||||
/**
|
||||
* @small
|
||||
*/
|
||||
public function testGetAllKeys() {
|
||||
if ($this->cache instanceof MemcachedCacheDriver) {
|
||||
$this->markTestSkipped('Memcached doesn\'t support getAllKeys anymore');
|
||||
}
|
||||
|
||||
$this->assertTrue($this->instance->set('value1', 'test'));
|
||||
$this->assertTrue($this->instance->set('value2', 'test'));
|
||||
$this->assertTrue($this->instance->set('test_value3', 'test'));
|
||||
|
||||
$list = $this->instance->getAllKeys();
|
||||
|
||||
$this->assertContains('value1', $list);
|
||||
$this->assertContains('value2', $list);
|
||||
$this->assertContains('test_value3', $list);
|
||||
|
||||
$list = $this->instance->getAllKeys('test');
|
||||
|
||||
$this->assertContains('test_value3', $list);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue