Browse Source

Fixing Cache tests

José Lorenzo Rodríguez 15 years ago
parent
commit
72c6e0cd58

+ 2 - 2
lib/Cake/Cache/Cache.php

@@ -125,9 +125,9 @@ class Cache {
 	protected static function _buildEngine($name) {
 		$config = self::$_config[$name];
 
-		list($plugin, $class) = pluginSplit($config['engine']);
+		list($plugin, $class) = pluginSplit($config['engine'], true);
 		$cacheClass = $class . 'Engine';
-		App::uses($cacheClass, 'Cache/Engine');
+		App::uses($cacheClass, $plugin . 'Cache/Engine');
 		if (!class_exists($cacheClass)) {
 			return false;
 		}

+ 6 - 14
lib/Cake/tests/cases/libs/cache.test.php

@@ -16,9 +16,8 @@
  * @since         CakePHP(tm) v 1.2.0.5432
  * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
  */
-if (!class_exists('Cache')) {
-	require LIBS . 'cache.php';
-}
+
+App::uses('Cache', 'Cache');
 
 /**
  * CacheTest class
@@ -234,19 +233,12 @@ class CacheTest extends CakeTestCase {
  * @return void
  */
 	function testInitSettings() {
-		Cache::config('default', array('engine' => 'File', 'path' => TMP . 'tests'));
+		$initial = Cache::settings();
+		$override = array('engine' => 'File', 'path' => TMP . 'tests');
+		Cache::config('default', $override);
 
 		$settings = Cache::settings();
-		$expecting = array(
-			'engine' => 'File',
-			'duration'=> 3600,
-			'probability' => 100,
-			'path'=> TMP . 'tests',
-			'prefix'=> 'cake_',
-			'lock' => false,
-			'serialize'=> true,
-			'isWindows' => DIRECTORY_SEPARATOR == '\\'
-		);
+		$expecting = $override + $initial;
 		$this->assertEqual($settings, $expecting);
 	}
 

lib/Cake/tests/test_app/libs/cache/test_app_cache.php → lib/Cake/tests/test_app/libs/Cache/Engine/TestAppCacheEngine.php


lib/Cake/tests/test_app/plugins/test_plugin/libs/cache/test_plugin_cache.php → lib/Cake/tests/test_app/plugins/test_plugin/libs/Cache/Engine/TestPluginCacheEngine.php