Make tests skip redis integration if the extension is not installed
This commit is contained in:
parent
f940606f0c
commit
672552a1e8
@ -15,6 +15,12 @@ class CacheRedisDriverTestTwo extends AnimeClient_TestCase {
|
|||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
if ( ! class_exists('Redis'))
|
||||||
|
{
|
||||||
|
$this->markTestSkipped('Redis extension not installed');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// Setup config with port and password
|
// Setup config with port and password
|
||||||
$container = new Container();
|
$container = new Container();
|
||||||
$container->set('config', new Config([
|
$container->set('config', new Config([
|
||||||
@ -27,10 +33,15 @@ class CacheRedisDriverTestTwo extends AnimeClient_TestCase {
|
|||||||
]));
|
]));
|
||||||
$this->driver = new RedisDriver($container);
|
$this->driver = new RedisDriver($container);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function tearDown()
|
public function tearDown()
|
||||||
{
|
{
|
||||||
parent::tearDown();
|
parent::tearDown();
|
||||||
|
|
||||||
|
if ( ! is_null($this->driver))
|
||||||
|
{
|
||||||
$this->driver->__destruct();
|
$this->driver->__destruct();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
@ -12,12 +12,25 @@ class CacheRedisDriverTest extends AnimeClient_TestCase {
|
|||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
if ( ! class_exists('Redis'))
|
||||||
|
{
|
||||||
|
$this->markTestSkipped('Redis extension not installed');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$this->driver = new RedisDriver($this->container);
|
$this->driver = new RedisDriver($this->container);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function tearDown()
|
public function tearDown()
|
||||||
{
|
{
|
||||||
parent::tearDown();
|
parent::tearDown();
|
||||||
|
|
||||||
|
if ( ! is_null($this->driver))
|
||||||
|
{
|
||||||
$this->driver->__destruct();
|
$this->driver->__destruct();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user