simplifying unittests (#5395)

* simplifying unittests

- use @requires instead class_exist
- define @small and @medium

* simplifying unittests

- removed unnecessary throwings
This commit is contained in:
Philipp 2018-07-18 21:04:18 +02:00 committed by Hypolite Petovan
parent 2fa6cc0000
commit 2d0446bd38
9 changed files with 83 additions and 87 deletions

View file

@ -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();
}
}