diff --git a/lib/Cake/Core/App.php b/lib/Cake/Core/App.php index 014f812db..bd587229f 100644 --- a/lib/Cake/Core/App.php +++ b/lib/Cake/Core/App.php @@ -531,45 +531,47 @@ class App { * @param string $className the name of the class to load */ public static function load($className) { - if (isset(self::$__classMap[$className])) { - if ($file = self::__mapped($className)) { + if (!isset(self::$__classMap[$className])) { + return false; + } + + if ($file = self::__mapped($className)) { + return include $file; + } + + $parts = explode('.', self::$__classMap[$className], 2); + list($plugin, $package) = count($parts) > 1 ? $parts : array(null, current($parts)); + $paths = self::path($package, $plugin); + + if (empty($plugin)) { + $appLibs = empty(self::$__packages['Lib']) ? APPLIBS : current(self::$__packages['Lib']); + $paths[] = $appLibs . $package . DS; + $paths[] = LIBS . $package . DS; + } + + foreach ($paths as $path) { + $file = $path . $className . '.php'; + if (file_exists($file)) { + self::__map($file, $className); return include $file; } + } - $parts = explode('.', self::$__classMap[$className], 2); - list($plugin, $package) = count($parts) > 1 ? $parts : array(null, current($parts)); - $paths = self::path($package, $plugin); - - if (empty($plugin)) { - $appLibs = empty(self::$__packages['Lib']) ? APPLIBS : current(self::$__packages['Lib']); - $paths[] = $appLibs . $package . DS; - $paths[] = LIBS . $package . DS; + //To help apps migrate to 2.0 old style file names are allowed + foreach ($paths as $path) { + $underscored = Inflector::underscore($className); + $tries = array($path . $underscored . '.php'); + $parts = explode('_', $underscored); + if (count($parts) > 1) { + array_pop($parts); + $tries[] = $path . implode('_', $parts) . '.php'; } - - foreach ($paths as $path) { - $file = $path . $className . '.php'; + foreach ($tries as $file) { if (file_exists($file)) { self::__map($file, $className); return include $file; } } - - //To help apps migrate to 2.0 old style file names are allowed - foreach ($paths as $path) { - $underscored = Inflector::underscore($className); - $tries = array($path . $underscored . '.php'); - $parts = explode('_', $underscored); - if (count($parts) > 1) { - array_pop($parts); - $tries[] = $path . implode('_', $parts) . '.php'; - } - foreach ($tries as $file) { - if (file_exists($file)) { - self::__map($file, $className); - return include $file; - } - } - } } return false; diff --git a/lib/Cake/Model/Datasource/Session/CacheSession.php b/lib/Cake/Model/Datasource/Session/CacheSession.php index 9b1b4ded0..29cacc218 100644 --- a/lib/Cake/Model/Datasource/Session/CacheSession.php +++ b/lib/Cake/Model/Datasource/Session/CacheSession.php @@ -16,6 +16,9 @@ * @since CakePHP(tm) v 2.0 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ + +App::uses('Cache', 'Cache'); + /** * CacheSession provides method for saving sessions into a Cache engine. Used with CakeSession * diff --git a/lib/Cake/TestSuite/CakeTestCase.php b/lib/Cake/TestSuite/CakeTestCase.php index b769ebdf0..ad5594d81 100644 --- a/lib/Cake/TestSuite/CakeTestCase.php +++ b/lib/Cake/TestSuite/CakeTestCase.php @@ -72,6 +72,7 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase { */ protected $_configure = array(); + /** * Runs the test case and collects the results in a TestResult object. * If no TestResult object is passed a new one will be created.