Make tests not fail when extensions are installed

If the extensions are installed but memcached/redis are not running
errors should not be emitted.
This commit is contained in:
mark_story 2016-02-18 21:14:55 -05:00
parent 7a5907057a
commit 8f3df8b13e
2 changed files with 13 additions and 0 deletions

View file

@ -64,6 +64,12 @@ class MemcachedEngineTest extends CakeTestCase {
parent::setUp();
$this->skipIf(!class_exists('Memcached'), 'Memcached is not installed or configured properly.');
// @codingStandardsIgnoreStart
$socket = @fsockopen('127.0.0.1', 11211, $errno, $errstr, 1);
// @codingStandardsIgnoreEnd
$this->skipIf(!$socket, 'Memcached is not running.');
fclose($socket);
Cache::config('memcached', array(
'engine' => 'Memcached',
'prefix' => 'cake_',

View file

@ -37,6 +37,13 @@ class RedisEngineTest extends CakeTestCase {
$this->_cacheDisable = Configure::read('Cache.disable');
Configure::write('Cache.disable', false);
// @codingStandardsIgnoreStart
$socket = @fsockopen('127.0.0.1', 6379, $errno, $errstr, 1);
// @codingStandardsIgnoreEnd
$this->skipIf(!$socket, 'Redis is not running.');
fclose($socket);
Cache::config('redis', array(
'engine' => 'Redis',
'prefix' => 'cake_',