Fixing view files finding and making tests pass

This commit is contained in:
José Lorenzo Rodríguez 2010-12-18 22:09:08 -04:30
parent ad78f1dc74
commit 151a4bdb33
3 changed files with 7 additions and 7 deletions

View file

@ -54,11 +54,11 @@ class HelperCollection extends ObjectCollection {
return $this->_loaded[$name];
}
$helperClass = $name . 'Helper';
App::uses($helperClass, 'View/Helper');
App::uses($helperClass, $plugin . 'View/Helper');
if (!class_exists($helperClass)) {
throw new MissingHelperClassException(array(
'class' => $helperClass,
'file' => Inflector::underscore($name) . '.php'
'file' => $helperClass . '.php'
));
}
$this->_loaded[$name] = new $helperClass($this->_View, $settings);

View file

@ -803,7 +803,7 @@ class View extends Object {
}
$paths = array();
$viewPaths = App::path('View');
$corePaths = array_flip(App::core('views'));
$corePaths = array_flip(App::core('View'));
if (!empty($plugin)) {
$count = count($viewPaths);
@ -812,10 +812,10 @@ class View extends Object {
$paths[] = $viewPaths[$i] . 'plugins' . DS . $plugin . DS;
}
}
$paths[] = App::pluginPath($plugin) . 'views' . DS;
$paths = array_merge($paths, App::path('View', $plugin));
}
$this->__paths = array_merge($paths, $viewPaths, array_flip($corePaths));
$this->__paths = array_unique(array_merge($paths, $viewPaths, array_keys($corePaths)));
return $this->__paths;
}
}

View file

@ -204,7 +204,7 @@ class ViewTest extends CakeTestCase {
'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS),
'views' => array(
TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS,
TEST_CAKE_CORE_INCLUDE_PATH . 'libs' . DS . 'view' . DS
TEST_CAKE_CORE_INCLUDE_PATH . 'View' . DS
)
), true);
@ -268,7 +268,7 @@ class ViewTest extends CakeTestCase {
TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views' . DS . 'plugins' . DS . 'test_plugin' . DS,
TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS . 'test_plugin' . DS . 'views' . DS,
TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views' . DS,
TEST_CAKE_CORE_INCLUDE_PATH . 'libs' . DS . 'view' . DS
TEST_CAKE_CORE_INCLUDE_PATH . 'View' . DS
);
$this->assertEqual($paths, $expected);
}