Skip to content

Commit

Permalink
Cache should remove old settings when upgrading settings
Browse files Browse the repository at this point in the history
When converting engine => className the old key should be removed.
  • Loading branch information
markstory committed Aug 17, 2013
1 parent ab70825 commit cfaef56
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/Cake/Cache/Cache.php
Expand Up @@ -178,6 +178,7 @@ public static function config($key, $config = null) {
}
if (isset($config['engine']) && empty($config['className'])) {
$config['className'] = $config['engine'];
unset($config['engine']);
}
static::$_config[$key] = $config;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Cache/CacheRegistry.php
Expand Up @@ -58,7 +58,7 @@ protected function _throwMissingClassError($class, $plugin) {
* Create the cache engine instance.
*
* Part of the template method for Cake\Utility\ObjectRegistry::load()
* @param string|CacheEngine $class The classname or object to make.
* @param string|CacheEngine|Closure $class The classname or object to make, or a closure factory.
* @param array $settings An array of settings to use for the cache engine.
* @return CacheEngine The constructed CacheEngine class.
* @throws Cake\Error\Exception when an object doesn't implement
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Test/TestCase/Cache/CacheTest.php
Expand Up @@ -219,7 +219,7 @@ public function testConfigRead() {
Cache::config('tests', $settings);
$expected = $settings;
$expected['className'] = $settings['engine'];
unset($settings['engine']);
unset($expected['engine']);
$this->assertEquals($expected, Cache::config('tests'));
}

Expand Down

0 comments on commit cfaef56

Please sign in to comment.