mirror of
https://github.com/friendica/friendica
synced 2025-04-22 09:50:12 +00:00
Fixed memcache & unittests
This commit is contained in:
parent
80a4e6263f
commit
065b83d148
4 changed files with 81 additions and 1 deletions
40
tests/src/Core/Lock/MemcacheCacheLockDriverTest.php
Normal file
40
tests/src/Core/Lock/MemcacheCacheLockDriverTest.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 MemcacheCacheLockDriverTest extends LockTest
|
||||
{
|
||||
/**
|
||||
* @var \Friendica\Core\Cache\IMemoryCacheDriver
|
||||
*/
|
||||
private $cache;
|
||||
|
||||
protected function getInstance()
|
||||
{
|
||||
if (class_exists('Memcache')) {
|
||||
try {
|
||||
$this->cache = CacheDriverFactory::create('memcache');
|
||||
} catch (\Exception $exception) {
|
||||
print "Memcache - TestCase failed: " . $exception->getMessage();
|
||||
throw new \Exception();
|
||||
}
|
||||
return new CacheLockDriver($this->cache);
|
||||
} else {
|
||||
$this->markTestSkipped('Memcache driver isn\'t available');
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
if (class_exists('Memcache')) {
|
||||
$this->cache->clear();
|
||||
}
|
||||
parent::tearDown();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue