diff --git a/cake/libs/view/view.php b/cake/libs/view/view.php index 562295af4..c4b3efb36 100644 --- a/cake/libs/view/view.php +++ b/cake/libs/view/view.php @@ -52,7 +52,7 @@ class View extends Object { /** * Name of the plugin. * - * @link http://manual.cakephp.org/chapter/plugins + * @link http://manual.cakephp.org/chapter/plugins * @var string */ public $plugin = null; diff --git a/cake/tests/cases/libs/view/view.test.php b/cake/tests/cases/libs/view/view.test.php index 6fc2b1675..705e76c6a 100644 --- a/cake/tests/cases/libs/view/view.test.php +++ b/cake/tests/cases/libs/view/view.test.php @@ -150,6 +150,20 @@ class TestView extends View { return $this->_paths($plugin, $cached); } +/** + * _render wrapper for testing (temporary). + * + * @param string $___viewFn + * @param string $___dataForView + * @param string $loadHelpers + * @param string $cached + * @return void + * @author Mark Story + */ + function render_($___viewFn, $___dataForView, $loadHelpers = true, $cached = false) { + return $this->_render($___viewFn, $___dataForView, $loadHelpers, $cached); + } + /** * cakeError method * @@ -159,7 +173,7 @@ class TestView extends View { * @return void */ function cakeError($method, $messages) { - $error =& new ViewTestErrorHandler($method, $messages); + $error = new ViewTestErrorHandler($method, $messages); return $error; } @@ -207,7 +221,7 @@ class TestAfterHelper extends Helper { * @return void */ function afterLayout() { - $View =& ClassRegistry::getObject('afterView'); + $View = ClassRegistry::getObject('afterView'); $View->output .= 'modified in the afterlife'; } } @@ -506,9 +520,9 @@ class ViewTest extends CakeTestCase { */ function testElementCacheHelperNoCache() { $Controller = new ViewPostsController(); - $View = new View($Controller); + $View = new TestView($Controller); $empty = array(); - $helpers = $View->_loadHelpers($empty, array('cache')); + $helpers = $View->loadHelpers($empty, array('cache')); $View->loaded = $helpers; $result = $View->element('test_element', array('ram' => 'val', 'test' => array('foo', 'bar'))); $this->assertEqual($result, 'this is the test element'); @@ -576,11 +590,11 @@ class ViewTest extends CakeTestCase { $View = new TestView($this->PostsController); $loaded = array(); - $result = $View->loadHelpers($loaded, array('Html', 'Form', 'Ajax')); + $result = $View->loadHelpers($loaded, array('Html', 'Form', 'Paginator')); $this->assertTrue(is_object($result['Html'])); $this->assertTrue(is_object($result['Form'])); $this->assertTrue(is_object($result['Form']->Html)); - $this->assertTrue(is_object($result['Ajax']->Html)); + $this->assertTrue(is_object($result['Paginator']->Html)); $View->plugin = 'test_plugin'; $result = $View->loadHelpers($loaded, array('TestPlugin.PluggedHelper')); @@ -595,7 +609,7 @@ class ViewTest extends CakeTestCase { */ function testHelperCallbackTriggering() { $this->PostsController->helpers = array('Session', 'Html', 'CallbackMock'); - $View =& new TestView($this->PostsController); + $View = new TestView($this->PostsController); $loaded = array(); $View->loaded = $View->loadHelpers($loaded, $this->PostsController->helpers); $View->loaded['CallbackMock']->expectOnce('beforeRender'); @@ -613,7 +627,7 @@ class ViewTest extends CakeTestCase { */ function testBeforeLayout() { $this->PostsController->helpers = array('Session', 'TestAfter', 'Html'); - $View =& new View($this->PostsController); + $View = new View($this->PostsController); $out = $View->render('index'); $this->assertEqual($View->loaded['testAfter']->property, 'Valuation'); } @@ -628,7 +642,7 @@ class ViewTest extends CakeTestCase { $this->PostsController->helpers = array('Session', 'TestAfter', 'Html'); $this->PostsController->set('variable', 'values'); - $View =& new View($this->PostsController); + $View = new View($this->PostsController); ClassRegistry::addObject('afterView', $View); $content = 'This is my view output'; @@ -644,35 +658,35 @@ class ViewTest extends CakeTestCase { * @return void */ function testRenderLoadHelper() { - $this->PostsController->helpers = array('Session', 'Html', 'Form', 'Ajax'); - $View =& new TestView($this->PostsController); + $this->PostsController->helpers = array('Session', 'Html', 'Form', 'Number'); + $View = new TestView($this->PostsController); - $result = $View->_render($View->getViewFileName('index'), array()); + $result = $View->render_($View->getViewFileName('index'), array()); $this->assertEqual($result, 'posts index'); $helpers = $View->loaded; - $this->assertTrue(is_object($helpers['html'])); - $this->assertTrue(is_object($helpers['form'])); - $this->assertTrue(is_object($helpers['form']->Html)); - $this->assertTrue(is_object($helpers['ajax']->Html)); + $this->assertTrue($helpers['html'] instanceof HtmlHelper); + $this->assertTrue($helpers['form'] instanceof FormHelper); + $this->assertTrue($helpers['form']->Html instanceof HtmlHelper); + $this->assertTrue($helpers['number'] instanceof NumberHelper); - $this->PostsController->helpers = array('Html', 'Form', 'Ajax', 'TestPlugin.PluggedHelper'); - $View =& new TestView($this->PostsController); + $this->PostsController->helpers = array('Html', 'Form', 'Number', 'TestPlugin.PluggedHelper'); + $View = new TestView($this->PostsController); - $result = $View->_render($View->getViewFileName('index'), array()); + $result = $View->render_($View->getViewFileName('index'), array()); $this->assertEqual($result, 'posts index'); $helpers = $View->loaded; - $this->assertTrue(is_object($helpers['html'])); - $this->assertTrue(is_object($helpers['form'])); - $this->assertTrue(is_object($helpers['form']->Html)); - $this->assertTrue(is_object($helpers['ajax']->Html)); - $this->assertTrue(is_object($helpers['pluggedHelper']->OtherHelper)); + $this->assertTrue($helpers['html'] instanceof HtmlHelper); + $this->assertTrue($helpers['form'] instanceof FormHelper); + $this->assertTrue($helpers['form']->Html instanceof HtmlHelper); + $this->assertTrue($helpers['number'] instanceof NumberHelper); + $this->assertTrue($helpers['pluggedHelper']->OtherHelper instanceof OtherHelperHelper); - $this->assertTrue(is_object($View->Html)); - $this->assertTrue(is_object($View->Form)); - $this->assertTrue(is_object($View->Form->Html)); - $this->assertTrue(is_object($View->PluggedHelper->OtherHelper)); + $this->assertTrue($View->Html instanceof HtmlHelper); + $this->assertTrue($View->Form instanceof FormHelper); + $this->assertTrue($View->Form->Html instanceof HtmlHelper); + $this->assertTrue($View->PluggedHelper->OtherHelper instanceof OtherHelperHelper); $this->assertReference($View->Form, $View->loaded['form']); $this->assertReference($View->Html, $View->loaded['html']); $this->assertReference($View->PluggedHelper->OtherHelper, $View->loaded['otherHelper']); @@ -685,7 +699,7 @@ class ViewTest extends CakeTestCase { * @return void */ function testRender() { - $View =& new TestView($this->PostsController); + $View = new TestView($this->PostsController); $result = str_replace(array("\t", "\r\n", "\n"), "", $View->render('index')); $this->assertPattern("/