mirror of
https://github.com/friendica/friendica
synced 2025-04-22 03:50: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
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue