X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=tests%2Fsrc%2FCore%2FLock%2FMemcacheCacheLockTest.php;h=f4aab0602cd943cc6cd3c5c2be0cdf96277c083f;hb=28864d8fdd032032938327ebd35ffe2d3d0de3b8;hp=f550ac51a6949554dbe6f17f083d66025005256b;hpb=4c4ed63dca13cc0382af9020e69980c63f988b47;p=friendica.git diff --git a/tests/src/Core/Lock/MemcacheCacheLockTest.php b/tests/src/Core/Lock/MemcacheCacheLockTest.php index f550ac51a6..f4aab0602c 100644 --- a/tests/src/Core/Lock/MemcacheCacheLockTest.php +++ b/tests/src/Core/Lock/MemcacheCacheLockTest.php @@ -1,30 +1,77 @@ . + * + */ namespace Friendica\Test\src\Core\Lock; use Friendica\Core\Cache\MemcacheCache; -use Friendica\Core\Config\Configuration; +use Friendica\Core\Config\IConfig; use Friendica\Core\Lock\CacheLock; /** * @requires extension Memcache + * @group MEMCACHE */ class MemcacheCacheLockTest extends LockTest { protected function getInstance() { - $configMock = \Mockery::mock(Configuration::class); + $configMock = \Mockery::mock(IConfig::class); + + $host = $_SERVER['MEMCACHE_HOST'] ?? 'localhost'; + $port = $_SERVER['MEMCACHE_PORT'] ?? '11211'; $configMock ->shouldReceive('get') ->with('system', 'memcache_host') - ->andReturn('localhost'); + ->andReturn($host); $configMock ->shouldReceive('get') ->with('system', 'memcache_port') - ->andReturn(11211); + ->andReturn($port); + + $lock = null; + + try { + $cache = new MemcacheCache($host, $configMock); + $lock = new CacheLock($cache); + } catch (\Exception $e) { + $this->markTestSkipped('Memcache is not available'); + } - return new CacheLock(new MemcacheCache('localhost', $configMock)); + return $lock; + } + + /** + * @small + */ + public function testGetLocks() + { + $this->markTestIncomplete('Race condition because of too fast getAllKeys() which uses a workaround'); + } + + /** + * @small + */ + public function testGetLocksWithPrefix() + { + $this->markTestIncomplete('Race condition because of too fast getAllKeys() which uses a workaround'); } }