Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Minor refactor to remove method calls to Inflector::camelize.
Adding tests to ensure references are maintained.
  • Loading branch information
markstory committed Sep 3, 2009
1 parent 7569534 commit 2ff5334
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 18 deletions.
15 changes: 4 additions & 11 deletions cake/libs/view/view.php
@@ -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
*/

Expand Down Expand Up @@ -699,10 +694,8 @@ function _render($___viewFn, $___dataForView, $loadHelpers = true, $cached = fal
$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');
}
Expand Down
12 changes: 5 additions & 7 deletions cake/tests/cases/libs/view/view.test.php
@@ -1,6 +1,4 @@
<?php
/* SVN FILE: $Id$ */

/**
* ViewTest file
*
Expand All @@ -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'));
Expand Down Expand Up @@ -658,6 +653,9 @@ function testRenderLoadHelper() {
$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']);
}

/**
Expand Down

0 comments on commit 2ff5334

Please sign in to comment.