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