Ensure memcached extension is there before attempting to create an instance.

This commit is contained in:
Andreas Fischer 2013-12-09 14:31:35 +01:00
parent a67c737848
commit 67310b60f7
1 changed files with 3 additions and 4 deletions

View File

@ -11,6 +11,9 @@ namespace Test\Memcache;
class Memcached extends Cache {
static public function setUpBeforeClass() {
if (!\OC\Memcache\Memcached::isAvailable()) {
self::markTestSkipped('The memcached extension is not available.');
}
$instance = new \OC\Memcache\Memcached(uniqid());
if ($instance->set(uniqid(), uniqid()) === false) {
self::markTestSkipped('memcached server seems to be down.');
@ -18,10 +21,6 @@ class Memcached extends Cache {
}
public function setUp() {
if (!\OC\Memcache\Memcached::isAvailable()) {
$this->markTestSkipped('The memcached extension is not available.');
return;
}
$this->instance = new \OC\Memcache\Memcached(uniqid());
}
}