2018-07-07 16:15:03 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
namespace Friendica\Test\src\Core\Lock;
|
|
|
|
|
2019-08-04 10:26:53 +02:00
|
|
|
use Friendica\Core\Cache\RedisCache;
|
2019-08-03 20:48:56 +02:00
|
|
|
use Friendica\Core\Config\Configuration;
|
2019-08-04 15:42:39 +02:00
|
|
|
use Friendica\Core\Lock\CacheLock;
|
2018-07-07 16:15:03 +02:00
|
|
|
|
2018-07-18 21:04:18 +02:00
|
|
|
/**
|
|
|
|
* @requires extension redis
|
|
|
|
*/
|
2019-08-04 10:26:53 +02:00
|
|
|
class RedisCacheLockTest extends LockTest
|
2018-07-07 16:15:03 +02:00
|
|
|
{
|
|
|
|
protected function getInstance()
|
|
|
|
{
|
2019-08-03 20:48:56 +02:00
|
|
|
$configMock = \Mockery::mock(Configuration::class);
|
|
|
|
|
|
|
|
$configMock
|
2019-02-07 20:44:03 +01:00
|
|
|
->shouldReceive('get')
|
2019-02-17 21:41:45 +01:00
|
|
|
->with('system', 'redis_host')
|
2019-02-07 20:44:03 +01:00
|
|
|
->andReturn('localhost');
|
2019-08-03 20:48:56 +02:00
|
|
|
$configMock
|
2019-02-07 20:44:03 +01:00
|
|
|
->shouldReceive('get')
|
2019-02-17 21:41:45 +01:00
|
|
|
->with('system', 'redis_port')
|
2019-02-07 20:44:03 +01:00
|
|
|
->andReturn(null);
|
2018-07-18 21:04:18 +02:00
|
|
|
|
2019-08-03 20:48:56 +02:00
|
|
|
$configMock
|
2019-04-20 14:20:31 +02:00
|
|
|
->shouldReceive('get')
|
2019-08-03 20:48:56 +02:00
|
|
|
->with('system', 'redis_db', 0)
|
2019-04-20 14:20:31 +02:00
|
|
|
->andReturn(3);
|
2019-08-03 20:48:56 +02:00
|
|
|
$configMock
|
2019-04-20 14:20:31 +02:00
|
|
|
->shouldReceive('get')
|
|
|
|
->with('system', 'redis_password')
|
|
|
|
->andReturn(null);
|
|
|
|
|
2019-08-04 15:42:39 +02:00
|
|
|
return new CacheLock(new RedisCache('localhost', $configMock));
|
2018-07-07 16:15:03 +02:00
|
|
|
}
|
|
|
|
}
|