Corrected view tests.

Added fix for Ticket #2245
Refactored loading of components and helpers to allow for use of dot notation with plugins.

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4659 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2007-03-23 10:34:21 +00:00
parent 7cc6185076
commit c20a8c80f3
4 changed files with 14 additions and 10 deletions

View file

@ -353,6 +353,8 @@ class Dispatcher extends Object {
$controller->output =& $output;
foreach($controller->components as $c) {
$path = preg_split('/\/|\./', $c);
$c = $path[count($path) - 1];
if (isset($controller->{$c}) && is_object($controller->{$c}) && is_callable(array($controller->{$c}, 'shutdown'))) {
if (!array_key_exists('enabled', get_object_vars($controller->{$c})) || $controller->{$c}->enabled == true) {
$controller->{$c}->shutdown($controller);
@ -385,6 +387,8 @@ class Dispatcher extends Object {
$controller->beforeFilter();
foreach($controller->components as $c) {
$path = preg_split('/\/|\./', $c);
$c = $path[count($path) - 1];
if (isset($controller->{$c}) && is_object($controller->{$c}) && is_callable(array($controller->{$c}, 'startup'))) {
if (!array_key_exists('enabled', get_object_vars($controller->{$c})) || $controller->{$c}->enabled == true) {
$controller->{$c}->startup($controller);

View file

@ -85,13 +85,13 @@ class Component extends Object {
$components[] = 'Session';
foreach($components as $component) {
$pos = strpos($component, '/');
if ($pos === false) {
$parts = preg_split('/\/|\./', $component);
if(count($parts) === 1) {
$plugin = $this->controller->plugin;
} else {
$parts = explode('/', $component);
$plugin = Inflector::underscore($parts['0']);
$component = $parts['1'];
$component = $parts[count($parts) - 1];
}
$componentCn = $component . 'Component';

View file

@ -824,13 +824,13 @@ class View extends Object {
$helpers[] = 'Session';
foreach($helpers as $helper) {
$pos = strpos($helper, '/');
if ($pos === false) {
$parts = preg_split('/\/|\./', $helper);
if(count($parts) === 1) {
$plugin = $this->plugin;
} else {
$parts = explode('/', $helper);
$plugin = Inflector::underscore($parts['0']);
$helper = $parts['1'];
$helper = $parts[count($parts) - 1];
}
$helperCn = $helper . 'Helper';

View file

@ -54,7 +54,7 @@ class ViewTest extends UnitTestCase {
}
function testViewVars() {
$this->assertTrue($this->view->viewVars, array('testData' => 'Some test data', 'test2' => 'more data', 'test3' => 'even more data'));
$this->assertEqual($this->view->viewVars, array('testData' => 'Some test data', 'test2' => 'more data', 'test3' => 'even more data'));
}
function testUUIDGeneration() {