namespace Friendica\Test\src\Core\Cache;
-
use Friendica\Core\Cache\CacheDriverFactory;
-class RedisCacheDriverTest extends CacheTest
+/**
+ * @requires extension redis
+ */
+class RedisCacheDriverTest extends MemoryCacheTest
{
- /**
- * @var \Friendica\Core\Cache\IMemoryCacheDriver
- */
- private $cache;
-
protected function getInstance()
{
- if (class_exists('Redis')) {
- try {
- $this->cache = CacheDriverFactory::create('redis');
- } catch (\Exception $exception) {
- print "Redis - TestCase failed: " . $exception->getMessage();
- throw new \Exception();
- }
- return $this->cache;
- } else {
- $this->markTestSkipped('Redis driver isn\'t available');
- return null;
- }
+ $this->configCache
+ ->shouldReceive('get')
+ ->with('system', 'redis_host', NULL)
+ ->andReturn('localhost');
+
+ $this->configCache
+ ->shouldReceive('get')
+ ->with('system', 'redis_port', NULL)
+ ->andReturn(null);
+
+ $this->cache = CacheDriverFactory::create('redis');
+ return $this->cache;
}
public function tearDown()
{
- if (class_exists('Redis')) {
- $this->cache->clear();
- }
+ $this->cache->clear(false);
parent::tearDown();
}
}