diff --git a/lib/Cake/Test/Case/Utility/DebuggerTest.php b/lib/Cake/Test/Case/Utility/DebuggerTest.php index a1b5fcb54d7..845cb30b577 100644 --- a/lib/Cake/Test/Case/Utility/DebuggerTest.php +++ b/lib/Cake/Test/Case/Utility/DebuggerTest.php @@ -334,6 +334,8 @@ public function testExportVar() { response => object(CakeResponse) {} elementCache => 'default' elementCacheSettings => array() + Html => object(HtmlHelper) {} + Form => object(FormHelper) {} int => (int) 2 float => (float) 1.333 @@ -358,7 +360,6 @@ public function testExportVar() { ) [protected] _scripts => array() [protected] _paths => array() - [protected] _helpersLoaded => false [protected] _parents => array() [protected] _current => null [protected] _currentType => '' diff --git a/lib/Cake/Test/Case/View/HelperTest.php b/lib/Cake/Test/Case/View/HelperTest.php index 96648e508eb..0f9b8b7f8b2 100644 --- a/lib/Cake/Test/Case/View/HelperTest.php +++ b/lib/Cake/Test/Case/View/HelperTest.php @@ -975,7 +975,7 @@ public function testThatHelperHelpersAreNotAttached() { $Helper->OtherHelper; $result = $this->View->Helpers->enabled(); - $expected = array(); + $expected = array('Html'); $this->assertEquals($expected, $result, 'Helper helpers were attached to the collection.'); } diff --git a/lib/Cake/Test/Case/View/JsonViewTest.php b/lib/Cake/Test/Case/View/JsonViewTest.php index db30e3e85e8..2f390e35f40 100644 --- a/lib/Cake/Test/Case/View/JsonViewTest.php +++ b/lib/Cake/Test/Case/View/JsonViewTest.php @@ -146,8 +146,8 @@ public function testRenderWithView() { ) ); $Controller->set('user', $data); + $Controller->helpers = array('Paginator'); $View = new JsonView($Controller); - $View->helpers = array('Paginator'); $output = $View->render('index'); $expected = array('user' => 'fake', 'list' => array('item1', 'item2'), 'paging' => array('page' => 2)); diff --git a/lib/Cake/View/View.php b/lib/Cake/View/View.php index a189ea16baa..ec2ed9ad7fe 100644 --- a/lib/Cake/View/View.php +++ b/lib/Cake/View/View.php @@ -253,13 +253,6 @@ class View extends Object { */ protected $_paths = array(); -/** - * Indicate that helpers have been loaded. - * - * @var boolean - */ - protected $_helpersLoaded = false; - /** * The names of views and their parents used with View::extend(); * @@ -347,6 +340,7 @@ public function __construct(Controller $controller = null) { } $this->Helpers = new HelperCollection($this); $this->Blocks = new ViewBlock(); + $this->loadHelpers(); parent::__construct(); } @@ -460,9 +454,6 @@ public function render($view = null, $layout = null) { if ($this->hasRendered) { return true; } - if (!$this->_helpersLoaded) { - $this->loadHelpers(); - } $this->Blocks->set('content', ''); if ($view !== false && $viewFileName = $this->_getViewFileName($view)) { @@ -511,9 +502,6 @@ public function renderLayout($content, $layout = null) { return $this->Blocks->get('content'); } - if (!$this->_helpersLoaded) { - $this->loadHelpers(); - } if (empty($content)) { $content = $this->Blocks->get('content'); } @@ -881,7 +869,6 @@ public function loadHelpers() { list(, $class) = pluginSplit($properties['class']); $this->{$class} = $this->Helpers->load($properties['class'], $properties['settings']); } - $this->_helpersLoaded = true; } /** @@ -1194,9 +1181,6 @@ protected function _elementCache($name, $data, $options) { * @return string */ protected function _renderElement($file, $data, $options) { - if (!$this->_helpersLoaded) { - $this->loadHelpers(); - } if ($options['callbacks']) { $this->getEventManager()->dispatch(new CakeEvent('View.beforeRender', $this, array($file))); }