mirror of
https://github.com/friendica/friendica
synced 2025-04-22 03:50:11 +00:00
Added Lock Unittests & Bugfixings
Added Redis Lock Unittests Added Memcached Lock Unittests Fixed a bug in dba Fixed a bug in RedisLock
This commit is contained in:
parent
e719a25082
commit
1ffe0cfd81
10 changed files with 114 additions and 70 deletions
40
tests/src/Core/Lock/MemcachedCacheLockDriverTest.php
Normal file
40
tests/src/Core/Lock/MemcachedCacheLockDriverTest.php
Normal file
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace Friendica\Test\src\Core\Lock;
|
||||
|
||||
|
||||
use Friendica\Core\Cache\CacheDriverFactory;
|
||||
use Friendica\Core\Lock\CacheLockDriver;
|
||||
|
||||
class MemcachedCacheLockDriverTest extends LockTest
|
||||
{
|
||||
/**
|
||||
* @var \Friendica\Core\Cache\IMemoryCacheDriver
|
||||
*/
|
||||
private $cache;
|
||||
|
||||
protected function getInstance()
|
||||
{
|
||||
if (class_exists('Memcached')) {
|
||||
try {
|
||||
$this->cache = CacheDriverFactory::create('memcached');
|
||||
} catch (\Exception $exception) {
|
||||
print "Redis - TestCase failed: " . $exception->getMessage();
|
||||
throw new \Exception();
|
||||
}
|
||||
return new CacheLockDriver($this->cache);
|
||||
} else {
|
||||
$this->markTestSkipped('Redis driver isn\'t available');
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
if (class_exists('Redis')) {
|
||||
$this->cache->clear();
|
||||
}
|
||||
parent::tearDown();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue