Minor refactor to remove method calls to Inflector::camelize.

Adding tests to ensure references are maintained.
This commit is contained in:
mark_story 2009-09-03 09:37:25 -04:00
parent 75695341fa
commit 2ff5334347
2 changed files with 9 additions and 18 deletions

View file

@ -1,26 +1,21 @@
<?php
/* SVN FILE: $Id$ */
/**
* Methods for displaying presentation data in the view.
*
* PHP versions 4 and 5
*
* CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org)
* Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* Copyright 2005-2009, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @copyright Copyright 2005-2009, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.libs.view
* @since CakePHP(tm) v 0.10.0.1076
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
@ -699,10 +694,8 @@ class View extends Object {
$name = $helperNames[$i];
${$name} =& $loadedHelpers[$helpers[$i]];
$this->loaded[$name] =& ${$name};
$memberName = Inflector::camelize($name);
$this->{$memberName} =& ${$name};
$this->loaded[$helperNames[$i]] =& ${$name};
$this->{$helpers[$i]} =& ${$name};
}
$this->_triggerHelpers('beforeRender');
}

View file

@ -1,6 +1,4 @@
<?php
/* SVN FILE: $Id$ */
/**
* ViewTest file
*
@ -9,20 +7,17 @@
* PHP versions 4 and 5
*
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
* Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* Copyright 2005-2009, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
*
* Licensed under The Open Group Test Suite License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @copyright Copyright 2005-2009, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake
* @subpackage cake.tests.cases.libs
* @since CakePHP(tm) v 1.2.0.4206
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/
App::import('Core', array('View', 'Controller'));
@ -658,6 +653,9 @@ class ViewTest extends CakeTestCase {
$this->assertTrue(is_object($View->Form));
$this->assertTrue(is_object($View->Form->Html));
$this->assertTrue(is_object($View->PluggedHelper->OtherHelper));
$this->assertReference($View->Form, $View->loaded['form']);
$this->assertReference($View->Html, $View->loaded['html']);
$this->assertReference($View->PluggedHelper->OtherHelper, $View->loaded['otherHelper']);
}
/**