]> git.mxchange.org Git - friendica.git/blob - tests/src/Core/Lock/MemcacheCacheLockTest.php
Shorten "Configuration" to "Config" again, since the Wrapper is gone
[friendica.git] / tests / src / Core / Lock / MemcacheCacheLockTest.php
1 <?php
2
3
4 namespace Friendica\Test\src\Core\Lock;
5
6 use Friendica\Core\Cache\MemcacheCache;
7 use Friendica\Core\Config\IConfig;
8 use Friendica\Core\Lock\CacheLock;
9
10 /**
11  * @requires extension Memcache
12  * @group MEMCACHE
13  */
14 class MemcacheCacheLockTest extends LockTest
15 {
16         protected function getInstance()
17         {
18                 $configMock = \Mockery::mock(IConfig::class);
19
20                 $host = $_SERVER['MEMCACHE_HOST'] ?? 'localhost';
21
22                 $configMock
23                         ->shouldReceive('get')
24                         ->with('system', 'memcache_host')
25                         ->andReturn($host);
26                 $configMock
27                         ->shouldReceive('get')
28                         ->with('system', 'memcache_port')
29                         ->andReturn(11211);
30
31                 $lock = null;
32
33                 try {
34                         $cache = new MemcacheCache($host, $configMock);
35                         $lock = new CacheLock($cache);
36                 } catch (\Exception $e) {
37                         $this->markTestSkipped('Memcache is not available');
38                 }
39
40                 return $lock;
41         }
42
43         /**
44          * @small
45          */
46         public function testGetLocks()
47         {
48                 $this->markTestIncomplete('Race condition because of too fast getAllKeys() which uses a workaround');
49         }
50
51         /**
52          * @small
53          */
54         public function testGetLocksWithPrefix()
55         {
56                 $this->markTestIncomplete('Race condition because of too fast getAllKeys() which uses a workaround');
57         }
58 }