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 Memcache
*/
class MemcacheCacheLockDriverTest extends LockTest
{
/**
@ -16,25 +19,13 @@ class MemcacheCacheLockDriverTest extends LockTest
protected function getInstance()
{
if (class_exists('Memcache')) {
try {
$this->cache = CacheDriverFactory::create('memcache');
} catch (\Exception $exception) {
print "Memcache - TestCase failed: " . $exception->getMessage();
throw new \Exception();
}
return new CacheLockDriver($this->cache);
} else {
$this->markTestSkipped('Memcache driver isn\'t available');
return null;
}
$this->cache = CacheDriverFactory::create('memcache');
return new CacheLockDriver($this->cache);
}
public function tearDown()
{
if (class_exists('Memcache')) {
$this->cache->clear();
}
$this->cache->clear();
parent::tearDown();
}
}