X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=tests%2Fsrc%2FCore%2FLock%2FMemcacheCacheLockTest.php;h=98266852f9b808a3e5fd4b258adb69f5120a0403;hb=e6c054c27602a3acadac3c423273bdf748fcee27;hp=b4272b0d2511a4d36810b704a0e88a564752e4e4;hpb=86bf2ee45a7c7409dbc470b5b1706b19e7e40507;p=friendica.git diff --git a/tests/src/Core/Lock/MemcacheCacheLockTest.php b/tests/src/Core/Lock/MemcacheCacheLockTest.php index b4272b0d25..98266852f9 100644 --- a/tests/src/Core/Lock/MemcacheCacheLockTest.php +++ b/tests/src/Core/Lock/MemcacheCacheLockTest.php @@ -1,30 +1,81 @@ . + * + */ namespace Friendica\Test\src\Core\Lock; +use Exception; use Friendica\Core\Cache\MemcacheCache; -use Friendica\Core\Config\Configuration; -use Friendica\Core\Lock\CacheLockDriver; +use Friendica\Core\Config\IConfig; +use Friendica\Core\Lock\CacheLock; +use Mockery; /** * @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) { + static::markTestSkipped('Memcache is not available'); + } - return new CacheLockDriver(new MemcacheCache('localhost', $configMock)); + return $lock; + } + + /** + * @small + * @doesNotPerformAssertions + */ + public function testGetLocks() + { + static::markTestIncomplete('Race condition because of too fast getAllKeys() which uses a workaround'); + } + + /** + * @small + * @doesNotPerformAssertions + */ + public function testGetLocksWithPrefix() + { + static::markTestIncomplete('Race condition because of too fast getAllKeys() which uses a workaround'); } }