mirror of
https://github.com/friendica/friendica
synced 2025-04-24 04:30:11 +00:00
simplifying unittests (#5395)
* simplifying unittests - use @requires instead class_exist - define @small and @medium * simplifying unittests - removed unnecessary throwings
This commit is contained in:
parent
2fa6cc0000
commit
2d0446bd38
9 changed files with 83 additions and 87 deletions
|
@ -6,6 +6,9 @@ namespace Friendica\Test\src\Core\Cache;
|
|||
|
||||
use Friendica\Core\Cache\CacheDriverFactory;
|
||||
|
||||
/**
|
||||
* @requires extension redis
|
||||
*/
|
||||
class RedisCacheDriverTest extends MemoryCacheTest
|
||||
{
|
||||
/**
|
||||
|
@ -15,24 +18,13 @@ class RedisCacheDriverTest extends MemoryCacheTest
|
|||
|
||||
protected function getInstance()
|
||||
{
|
||||
if (class_exists('Redis')) {
|
||||
try {
|
||||
$this->cache = CacheDriverFactory::create('redis');
|
||||
} catch (\Exception $exception) {
|
||||
throw new \Exception("Redis - TestCase failed: " . $exception->getMessage(), $exception->getCode(), $exception);
|
||||
}
|
||||
return $this->cache;
|
||||
} else {
|
||||
$this->markTestSkipped('Redis driver isn\'t available');
|
||||
return null;
|
||||
}
|
||||
$this->cache = CacheDriverFactory::create('redis');
|
||||
return $this->cache;
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
if (class_exists('Redis')) {
|
||||
$this->cache->clear(false);
|
||||
}
|
||||
$this->cache->clear(false);
|
||||
parent::tearDown();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue