mirror of
https://github.com/friendica/friendica
synced 2025-03-31 14:00:15 +00:00
52 lines
1,011 B
PHP
52 lines
1,011 B
PHP
<?php
|
|
|
|
|
|
namespace Friendica\Test\src\Core\Cache;
|
|
|
|
use Friendica\Core\Cache\RedisCache;
|
|
use Friendica\Core\Config\IConfig;
|
|
|
|
/**
|
|
* @requires extension redis
|
|
* @group REDIS
|
|
*/
|
|
class RedisCacheTest extends MemoryCacheTest
|
|
{
|
|
protected function getInstance()
|
|
{
|
|
$configMock = \Mockery::mock(IConfig::class);
|
|
|
|
$host = $_SERVER['REDIS_HOST'] ?? 'localhost';
|
|
|
|
$configMock
|
|
->shouldReceive('get')
|
|
->with('system', 'redis_host')
|
|
->andReturn($host);
|
|
$configMock
|
|
->shouldReceive('get')
|
|
->with('system', 'redis_port')
|
|
->andReturn(null);
|
|
|
|
$configMock
|
|
->shouldReceive('get')
|
|
->with('system', 'redis_db', 0)
|
|
->andReturn(3);
|
|
$configMock
|
|
->shouldReceive('get')
|
|
->with('system', 'redis_password')
|
|
->andReturn(null);
|
|
|
|
try {
|
|
$this->cache = new RedisCache($host, $configMock);
|
|
} catch (\Exception $e) {
|
|
$this->markTestSkipped('Redis is not available.');
|
|
}
|
|
return $this->cache;
|
|
}
|
|
|
|
public function tearDown()
|
|
{
|
|
$this->cache->clear(false);
|
|
parent::tearDown();
|
|
}
|
|
}
|