From 8f3df8b13e151a67c8b7919896ce486bd36aeb35 Mon Sep 17 00:00:00 2001 From: mark_story Date: Thu, 18 Feb 2016 21:14:55 -0500 Subject: [PATCH] Make tests not fail when extensions are installed If the extensions are installed but memcached/redis are not running errors should not be emitted. --- lib/Cake/Test/Case/Cache/Engine/MemcachedEngineTest.php | 6 ++++++ lib/Cake/Test/Case/Cache/Engine/RedisEngineTest.php | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/lib/Cake/Test/Case/Cache/Engine/MemcachedEngineTest.php b/lib/Cake/Test/Case/Cache/Engine/MemcachedEngineTest.php index 867422b55..2e915c4ef 100644 --- a/lib/Cake/Test/Case/Cache/Engine/MemcachedEngineTest.php +++ b/lib/Cake/Test/Case/Cache/Engine/MemcachedEngineTest.php @@ -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_', diff --git a/lib/Cake/Test/Case/Cache/Engine/RedisEngineTest.php b/lib/Cake/Test/Case/Cache/Engine/RedisEngineTest.php index bbc7228d4..aec71a3ba 100644 --- a/lib/Cake/Test/Case/Cache/Engine/RedisEngineTest.php +++ b/lib/Cake/Test/Case/Cache/Engine/RedisEngineTest.php @@ -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_',