]> git.mxchange.org Git - friendica.git/blob - tests/src/Core/Lock/RedisCacheLockTest.php
Adding possibility to use a different cache-backend for locking and caching
[friendica.git] / tests / src / Core / Lock / RedisCacheLockTest.php
1 <?php
2
3
4 namespace Friendica\Test\src\Core\Lock;
5
6 use Friendica\Core\Cache\RedisCache;
7 use Friendica\Core\Config\Configuration;
8 use Friendica\Core\Lock\CacheLock;
9
10 /**
11  * @requires extension redis
12  */
13 class RedisCacheLockTest extends LockTest
14 {
15         protected function getInstance()
16         {
17                 $configMock = \Mockery::mock(Configuration::class);
18
19                 $configMock
20                         ->shouldReceive('get')
21                         ->with('system', 'redis_host')
22                         ->andReturn('localhost');
23                 $configMock
24                         ->shouldReceive('get')
25                         ->with('system', 'redis_port')
26                         ->andReturn(null);
27
28                 $configMock
29                         ->shouldReceive('get')
30                         ->with('system', 'redis_db', 0)
31                         ->andReturn(3);
32                 $configMock
33                         ->shouldReceive('get')
34                         ->with('system', 'redis_password')
35                         ->andReturn(null);
36
37                 return new CacheLock(new RedisCache('localhost', $configMock));
38         }
39 }