]> git.mxchange.org Git - friendica.git/blob - tests/src/Core/Lock/MemcachedCacheLockTest.php
Merge pull request #8079 from ozero/patch-1
[friendica.git] / tests / src / Core / Lock / MemcachedCacheLockTest.php
1 <?php
2
3
4 namespace Friendica\Test\src\Core\Lock;
5
6 use Friendica\Core\Cache\MemcachedCache;
7 use Friendica\Core\Config\IConfiguration;
8 use Friendica\Core\Lock\CacheLock;
9 use Psr\Log\NullLogger;
10
11 /**
12  * @requires extension memcached
13  * @group MEMCACHED
14  */
15 class MemcachedCacheLockTest extends LockTest
16 {
17         protected function getInstance()
18         {
19                 $configMock = \Mockery::mock(IConfiguration::class);
20
21                 $host = $_SERVER['MEMCACHED_HOST'] ?? 'localhost';
22
23                 $configMock
24                         ->shouldReceive('get')
25                         ->with('system', 'memcached_hosts')
26                         ->andReturn([0 => $host . ', 11211']);
27
28                 $logger = new NullLogger();
29
30                 $lock = null;
31
32                 try {
33                         $cache = new MemcachedCache($host, $configMock, $logger);
34                         $lock = new CacheLock($cache);
35                 } catch (\Exception $e) {
36                         $this->markTestSkipped('Memcached is not available');
37                 }
38
39                 return $lock;
40         }
41
42         public function testGetLocks()
43         {
44                 $this->markTestIncomplete('Race condition because of too fast getLocks() which uses a workaround');
45         }
46
47         public function testGetLocksWithPrefix()
48         {
49                 $this->markTestIncomplete('Race condition because of too fast getLocks() which uses a workaround');
50         }
51 }