diff --git a/Cake/Cache/Cache.php b/Cake/Cache/Cache.php index 8ac054d6421..1d9ba64eb2c 100644 --- a/Cake/Cache/Cache.php +++ b/Cake/Cache/Cache.php @@ -363,22 +363,6 @@ public static function clearGroup($group, $config = 'default') { return $success; } -/** - * Return the settings for the named cache engine. - * - * @param string $name Name of the configuration to get settings for. Defaults to 'default' - * @return array list of settings for this engine - * @see Cache::config() - */ - public static function settings($config = 'default') { - $engine = static::engine($config); - if (!$engine) { - return []; - } - - return $engine->settings(); - } - /** * Retrieve group names to config mapping. * diff --git a/Cake/Cache/CacheEngine.php b/Cake/Cache/CacheEngine.php index f1805e6b4ff..8d02216353f 100644 --- a/Cake/Cache/CacheEngine.php +++ b/Cake/Cache/CacheEngine.php @@ -70,8 +70,7 @@ abstract class CacheEngine { * @return boolean True if the engine has been successfully initialized, false if not */ public function init($config = []) { - $config += $this->_config + $this->_defaultConfig; - $this->_config = $config; + $this->_config = $config + $this->_defaultConfig; if (!empty($this->_config['groups'])) { sort($this->_config['groups']); $this->_groupPrefix = str_repeat('%s_', count($this->_config['groups'])); diff --git a/Cake/Test/TestCase/Cache/Engine/ApcEngineTest.php b/Cake/Test/TestCase/Cache/Engine/ApcEngineTest.php index 01aff34ed76..ed2190c3972 100644 --- a/Cake/Test/TestCase/Cache/Engine/ApcEngineTest.php +++ b/Cake/Test/TestCase/Cache/Engine/ApcEngineTest.php @@ -60,13 +60,13 @@ public function tearDown() { * * @return void */ - protected function _configCache($settings = []) { + protected function _configCache($config = []) { $defaults = [ 'className' => 'Apc', 'prefix' => 'cake_', ]; Cache::drop('apc'); - Cache::config('apc', array_merge($defaults, $settings)); + Cache::config('apc', array_merge($defaults, $config)); } /** diff --git a/Cake/Test/TestCase/Cache/Engine/FileEngineTest.php b/Cake/Test/TestCase/Cache/Engine/FileEngineTest.php index 18f81c44e37..4cedf9d9e0c 100644 --- a/Cake/Test/TestCase/Cache/Engine/FileEngineTest.php +++ b/Cake/Test/TestCase/Cache/Engine/FileEngineTest.php @@ -66,13 +66,13 @@ public function tearDown() { * * @return void */ - protected function _configCache($settings = []) { + protected function _configCache($config = []) { $defaults = [ 'className' => 'File', 'path' => TMP . 'tests', ]; Cache::drop('file_test'); - Cache::config('file_test', array_merge($defaults, $settings)); + Cache::config('file_test', array_merge($defaults, $config)); } /** diff --git a/Cake/Test/TestCase/Cache/Engine/MemcachedEngineTest.php b/Cake/Test/TestCase/Cache/Engine/MemcachedEngineTest.php index 8da430de1b7..3e011f0a028 100644 --- a/Cake/Test/TestCase/Cache/Engine/MemcachedEngineTest.php +++ b/Cake/Test/TestCase/Cache/Engine/MemcachedEngineTest.php @@ -71,14 +71,14 @@ public function setUp() { * * @return void */ - protected function _configCache($settings = []) { + protected function _configCache($config = []) { $defaults = [ 'className' => 'Memcached', 'prefix' => 'cake_', 'duration' => 3600 ]; Cache::drop('memcached'); - Cache::config('memcached', array_merge($defaults, $settings)); + Cache::config('memcached', array_merge($defaults, $config)); } /** @@ -98,13 +98,13 @@ public function tearDown() { } /** - * testSettings method + * testConfig method * * @return void */ - public function testSettings() { - $settings = Cache::settings('memcached'); - unset($settings['path']); + public function testConfig() { + $config = Cache::engine('memcached')->config(); + unset($config['path']); $expecting = array( 'prefix' => 'cake_', 'duration' => 3600, @@ -117,7 +117,7 @@ public function testSettings() { 'groups' => array(), 'serialize' => 'php' ); - $this->assertEquals($expecting, $settings); + $this->assertEquals($expecting, $config); } /** @@ -152,7 +152,7 @@ public function testCompressionSetting() { */ public function testInvalidSerializerSetting() { $Memcached = new TestMemcachedEngine(); - $settings = array( + $config = array( 'className' => 'Memcached', 'servers' => array('127.0.0.1:11211'), 'persistent' => false, @@ -162,7 +162,7 @@ public function testInvalidSerializerSetting() { $this->setExpectedException( 'Cake\Error\Exception', 'invalid_serializer is not a valid serializer engine for Memcached' ); - $Memcached->init($settings); + $Memcached->init($config); } /** @@ -172,14 +172,14 @@ public function testInvalidSerializerSetting() { */ public function testPhpSerializerSetting() { $Memcached = new TestMemcachedEngine(); - $settings = array( + $config = array( 'className' => 'Memcached', 'servers' => array('127.0.0.1:11211'), 'persistent' => false, 'serialize' => 'php' ); - $Memcached->init($settings); + $Memcached->init($config); $this->assertEquals(Memcached::SERIALIZER_PHP, $Memcached->getMemcached()->getOption(Memcached::OPT_SERIALIZER)); } @@ -195,14 +195,14 @@ public function testJsonSerializerSetting() { ); $Memcached = new TestMemcachedEngine(); - $settings = array( + $config = array( 'engine' => 'Memcached', 'servers' => array('127.0.0.1:11211'), 'persistent' => false, 'serialize' => 'json' ); - $Memcached->init($settings); + $Memcached->init($config); $this->assertEquals(Memcached::SERIALIZER_JSON, $Memcached->getMemcached()->getOption(Memcached::OPT_SERIALIZER)); } @@ -218,14 +218,14 @@ public function testIgbinarySerializerSetting() { ); $Memcached = new TestMemcachedEngine(); - $settings = array( + $config = array( 'engine' => 'Memcached', 'servers' => array('127.0.0.1:11211'), 'persistent' => false, 'serialize' => 'igbinary' ); - $Memcached->init($settings); + $Memcached->init($config); $this->assertEquals(Memcached::SERIALIZER_IGBINARY, $Memcached->getMemcached()->getOption(Memcached::OPT_SERIALIZER)); } @@ -241,7 +241,7 @@ public function testJsonSerializerThrowException() { ); $Memcached = new TestMemcachedEngine(); - $settings = array( + $config = array( 'className' => 'Memcached', 'servers' => array('127.0.0.1:11211'), 'persistent' => false, @@ -251,7 +251,7 @@ public function testJsonSerializerThrowException() { $this->setExpectedException( 'Cake\Error\Exception', 'Memcached extension is not compiled with json support' ); - $Memcached->init($settings); + $Memcached->init($config); } /** @@ -266,7 +266,7 @@ public function testIgbinarySerializerThrowException() { ); $Memcached = new TestMemcachedEngine(); - $settings = array( + $config = array( 'engine' => 'Memcached', 'servers' => array('127.0.0.1:11211'), 'persistent' => false, @@ -276,7 +276,7 @@ public function testIgbinarySerializerThrowException() { $this->setExpectedException( 'Cake\Error\Exception', 'Memcached extension is not compiled with igbinary support' ); - $Memcached->init($settings); + $Memcached->init($config); } /** @@ -287,7 +287,7 @@ public function testIgbinarySerializerThrowException() { */ public function testSaslAuthException() { $Memcached = new TestMemcachedEngine(); - $settings = array( + $config = array( 'engine' => 'Memcached', 'servers' => array('127.0.0.1:11211'), 'persistent' => false, @@ -303,11 +303,11 @@ public function testSaslAuthException() { $this->setExpectedException( 'Cake\Error\Exception', 'Memcached extension is not build with SASL support' ); - $Memcached->init($settings); + $Memcached->init($config); } /** - * testSettings method + * testConfig method * * @return void */ @@ -330,8 +330,8 @@ public function testMultipleServers() { $Memcached = new MemcachedEngine(); $Memcached->init(array('engine' => 'Memcached', 'servers' => $servers)); - $settings = $Memcached->settings(); - $this->assertEquals($settings['servers'], $servers); + $config = $Memcached->config(); + $this->assertEquals($config['servers'], $servers); Cache::drop('dual_server'); } @@ -649,7 +649,7 @@ public function testZeroDuration() { */ public function testLongDurationEqualToZero() { $memcached = new TestMemcachedEngine(); - $memcached->settings['compress'] = false; + $memcached->_config['compress'] = false; $mock = $this->getMock('Memcached'); $memcached->setMemcached($mock); diff --git a/Cake/Test/TestCase/Cache/Engine/RedisEngineTest.php b/Cake/Test/TestCase/Cache/Engine/RedisEngineTest.php index 8b72b318441..9dea1e9f329 100644 --- a/Cake/Test/TestCase/Cache/Engine/RedisEngineTest.php +++ b/Cake/Test/TestCase/Cache/Engine/RedisEngineTest.php @@ -55,23 +55,23 @@ public function tearDown() { * * @return void */ - protected function _configCache($settings = []) { + protected function _configCache($config = []) { $defaults = [ 'className' => 'Redis', 'prefix' => 'cake_', 'duration' => 3600 ]; Cache::drop('redis'); - Cache::config('redis', array_merge($defaults, $settings)); + Cache::config('redis', array_merge($defaults, $config)); } /** - * testSettings method + * testConfig method * * @return void */ - public function testSettings() { - $settings = Cache::settings('redis'); + public function testConfig() { + $config = Cache::engine('redis')->config(); $expecting = array( 'prefix' => 'cake_', 'duration' => 3600, @@ -84,7 +84,7 @@ public function testSettings() { 'password' => false, 'database' => 0, ); - $this->assertEquals($expecting, $settings); + $this->assertEquals($expecting, $config); } /** @@ -94,7 +94,7 @@ public function testSettings() { */ public function testConnect() { $Redis = new RedisEngine(); - $this->assertTrue($Redis->init(Cache::settings('redis'))); + $this->assertTrue($Redis->init(Cache::engine('redis')->config())); } /** diff --git a/Cake/Test/TestCase/Cache/Engine/WincacheEngineTest.php b/Cake/Test/TestCase/Cache/Engine/WincacheEngineTest.php index b211454354e..f6949a8a6af 100644 --- a/Cake/Test/TestCase/Cache/Engine/WincacheEngineTest.php +++ b/Cake/Test/TestCase/Cache/Engine/WincacheEngineTest.php @@ -56,13 +56,13 @@ public function tearDown() { * * @return void */ - protected function _configCache($settings = []) { + protected function _configCache($config = []) { $defaults = [ 'className' => 'Wincache', 'prefix' => 'cake_' ]; Cache::drop('wincache'); - Cache::config('wincache', array_merge($defaults, $settings)); + Cache::config('wincache', array_merge($defaults, $config)); } /** diff --git a/Cake/Test/TestCase/Cache/Engine/XcacheEngineTest.php b/Cake/Test/TestCase/Cache/Engine/XcacheEngineTest.php index fe3e0b4f18e..5f6461c49f6 100644 --- a/Cake/Test/TestCase/Cache/Engine/XcacheEngineTest.php +++ b/Cake/Test/TestCase/Cache/Engine/XcacheEngineTest.php @@ -47,13 +47,13 @@ public function setUp() { * * @return void */ - protected function _configCache($settings = []) { + protected function _configCache($config = []) { $defaults = [ 'className' => 'Xcache', 'prefix' => 'cake_', ]; Cache::drop('xcache'); - Cache::config('xcache', array_merge($defaults, $settings)); + Cache::config('xcache', array_merge($defaults, $config)); } /** @@ -68,22 +68,22 @@ public function tearDown() { } /** - * testSettings method + * testConfig method * * @return void */ - public function testSettings() { - $settings = Cache::settings(); + public function testConfig() { + $config = Cache::engine('xcache')->config(); $expecting = [ 'prefix' => 'cake_', 'duration' => 3600, 'probability' => 100, ]; - $this->assertTrue(isset($settings['PHP_AUTH_USER'])); - $this->assertTrue(isset($settings['PHP_AUTH_PW'])); + $this->assertTrue(isset($config['PHP_AUTH_USER'])); + $this->assertTrue(isset($config['PHP_AUTH_PW'])); - unset($settings['PHP_AUTH_USER'], $settings['PHP_AUTH_PW']); - $this->assertEquals($settings, $expecting); + unset($config['PHP_AUTH_USER'], $config['PHP_AUTH_PW']); + $this->assertEquals($config, $expecting); } /**