mirror of
https://github.com/friendica/friendica
synced 2025-04-24 04:30:11 +00:00
Added Unittests for cache
fixed Lock & Cache bugs
This commit is contained in:
parent
1dafaa69c5
commit
80a4e6263f
18 changed files with 317 additions and 25 deletions
39
tests/src/Core/Cache/RedisCacheDriverTest.php
Normal file
39
tests/src/Core/Cache/RedisCacheDriverTest.php
Normal file
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace Friendica\Test\src\Core\Cache;
|
||||
|
||||
|
||||
use Friendica\Core\Cache\CacheDriverFactory;
|
||||
|
||||
class RedisCacheDriverTest extends CacheTest
|
||||
{
|
||||
/**
|
||||
* @var \Friendica\Core\Cache\IMemoryCacheDriver
|
||||
*/
|
||||
private $cache;
|
||||
|
||||
protected function getInstance()
|
||||
{
|
||||
if (class_exists('Redis')) {
|
||||
try {
|
||||
$this->cache = CacheDriverFactory::create('redis');
|
||||
} catch (\Exception $exception) {
|
||||
print "Redis - TestCase failed: " . $exception->getMessage();
|
||||
throw new \Exception();
|
||||
}
|
||||
return $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