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

@ -7,6 +7,9 @@ namespace Friendica\Test\src\Core\Lock;
use Friendica\Core\Cache\CacheDriverFactory;
use Friendica\Core\Lock\CacheLockDriver;
/**
* @requires extension redis
*/
class RedisCacheLockDriverTest extends LockTest
{
/**
@ -16,25 +19,14 @@ class RedisCacheLockDriverTest extends LockTest
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 new CacheLockDriver($this->cache);
} else {
$this->markTestSkipped('Redis driver isn\'t available');
return null;
}
$this->cache = CacheDriverFactory::create('redis');
return new CacheLockDriver($this->cache);
}
public function tearDown()
{
if (class_exists('Redis')) {
$this->cache->clear();
}
$this->cache->clear();
parent::tearDown();
}
}