mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
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:
parent
7a5907057a
commit
8f3df8b13e
2 changed files with 13 additions and 0 deletions
|
@ -64,6 +64,12 @@ class MemcachedEngineTest extends CakeTestCase {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
$this->skipIf(!class_exists('Memcached'), 'Memcached is not installed or configured properly.');
|
$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(
|
Cache::config('memcached', array(
|
||||||
'engine' => 'Memcached',
|
'engine' => 'Memcached',
|
||||||
'prefix' => 'cake_',
|
'prefix' => 'cake_',
|
||||||
|
|
|
@ -37,6 +37,13 @@ class RedisEngineTest extends CakeTestCase {
|
||||||
|
|
||||||
$this->_cacheDisable = Configure::read('Cache.disable');
|
$this->_cacheDisable = Configure::read('Cache.disable');
|
||||||
Configure::write('Cache.disable', false);
|
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(
|
Cache::config('redis', array(
|
||||||
'engine' => 'Redis',
|
'engine' => 'Redis',
|
||||||
'prefix' => 'cake_',
|
'prefix' => 'cake_',
|
||||||
|
|
Loading…
Add table
Reference in a new issue