Skip memcache tests, see if we fix redis tests

This commit is contained in:
Timothy Warren 2017-03-01 09:34:06 -05:00
parent e30f461642
commit 2bb9c1fb67
3 changed files with 23 additions and 9 deletions

View File

@ -40,12 +40,10 @@ class RedisDriver extends AbstractDriver {
*/
public function __construct(array $config = [], array $options = [])
{
// @codeCoverageIgnoreStart
if ( ! class_exists('Predis\\Client'))
{
throw new CacheException("The redis driver requires the predis/predis composer package to be installed.");
}
// @codeCoverageIgnoreEnd
$this->conn = new Client($config, $options);
}

View File

@ -17,16 +17,24 @@
namespace Aviat\Banker\Tests\Driver;
use Aviat\Banker\Driver\MemcacheDriver;
use Aviat\Banker\Exception\CacheException;
class MemcacheDriverTest extends DriverTestBase {
public function setup()
{
$this->driver = new MemcacheDriver([
'host' => 'localhost',
'port' => '11211',
'persistent' => false,
]);
$this->driver->flush();
try
{
$this->driver = new MemcacheDriver([
'host' => 'localhost',
'port' => '11211',
'persistent' => false,
]);
$this->driver->flush();
}
catch (CacheException $e)
{
$this->markTestSkipped();
}
}
}

View File

@ -22,7 +22,15 @@ class RedisDriverTest extends DriverTestBase {
public function setup()
{
$this->driver = new RedisDriver();
$config = [];
if (array_key_exists('REDIS_HOST', $_ENV))
{
$config['scheme'] = 'tcp';
$config['host'] = $_ENV['REDIS_HOST'];
$config['port'] = 6379;
}
$this->driver = new RedisDriver($config);
$this->driver->flush();
}