From 1c204b74f5a67908b8fcf69068cee54457fe9669 Mon Sep 17 00:00:00 2001 From: ADmad Date: Sun, 16 Aug 2015 15:52:56 +0530 Subject: [PATCH] Update tests to use new methods. --- tests/TestCase/View/ViewTest.php | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/tests/TestCase/View/ViewTest.php b/tests/TestCase/View/ViewTest.php index 75312f9264d..4b0f0de1000 100644 --- a/tests/TestCase/View/ViewTest.php +++ b/tests/TestCase/View/ViewTest.php @@ -566,7 +566,7 @@ public function testGetViewFileNames() $result = $View->getViewFileName('TestPlugin.home'); $this->assertPathEquals($expected, $result, 'Plugin is missing the view, cascade to app.'); - $View->viewPath = 'Tests'; + $View->templatePath('Tests'); $expected = TEST_APP . 'Plugin' . DS . 'TestPlugin' . DS . 'src' . DS . 'Template' . DS . 'Tests' . DS . 'index.ctp'; $result = $View->getViewFileName('TestPlugin.index'); @@ -983,7 +983,7 @@ public function testElementCache() public function testViewEvent() { $View = $this->PostsController->createView(); - $View->viewPath = $this->PostsController->name; + $View->templatePath($this->PostsController->name); $View->autoLayout = false; $listener = new TestViewEventListenerInterface(); @@ -1091,7 +1091,7 @@ public function testInitialize() public function testHelperCallbackTriggering() { $View = $this->PostsController->createView(); - $View->viewPath = $this->PostsController->name; + $View->templatePath($this->PostsController->name); $manager = $this->getMock('Cake\Event\EventManager'); $View->eventManager($manager); @@ -1183,7 +1183,7 @@ public function testBeforeLayout() 'Html' ]; $View = $this->PostsController->createView(); - $View->viewPath = $this->PostsController->name; + $View->templatePath($this->PostsController->name); $View->render('index'); $this->assertEquals('Valuation', $View->helpers()->TestBeforeAfter->property); } @@ -1202,7 +1202,7 @@ public function testAfterLayout() $this->PostsController->set('variable', 'values'); $View = $this->PostsController->createView(); - $View->viewPath = $this->PostsController->name; + $View->templatePath($this->PostsController->name); $content = 'This is my view output'; $result = $View->renderLayout($content, 'default'); @@ -1219,7 +1219,7 @@ public function testRenderLoadHelper() { $this->PostsController->helpers = ['Form', 'Number']; $View = $this->PostsController->createView('Cake\Test\TestCase\View\TestView'); - $View->viewPath = $this->PostsController->name; + $View->templatePath($this->PostsController->name); $result = $View->render('index', false); $this->assertEquals('posts index', $result); @@ -1230,7 +1230,7 @@ public function testRenderLoadHelper() $this->PostsController->helpers = ['Html', 'Form', 'Number', 'TestPlugin.PluggedHelper']; $View = $this->PostsController->createView('Cake\Test\TestCase\View\TestView'); - $View->viewPath = $this->PostsController->name; + $View->templatePath($this->PostsController->name); $result = $View->render('index', false); $this->assertEquals('posts index', $result); @@ -1248,7 +1248,7 @@ public function testRenderLoadHelper() public function testRender() { $View = $this->PostsController->createView('Cake\Test\TestCase\View\TestView'); - $View->viewPath = $this->PostsController->name; + $View->templatePath($this->PostsController->name); $result = $View->render('index'); $this->assertRegExp("/\s*/", $result); @@ -1267,7 +1267,7 @@ public function testRender() Configure::write('Cache.check', true); $View = $this->PostsController->createView('Cake\Test\TestCase\View\TestView'); - $View->viewPath = $this->PostsController->name; + $View->templatePath($this->PostsController->name); $result = $View->render('index'); $this->assertRegExp("/<meta http-equiv=\"Content-Type\" content=\"text\/html; charset=utf-8\"\/>\s*<title>/", $result); @@ -1282,8 +1282,8 @@ public function testRender() public function testRenderUsingViewProperty() { $View = $this->PostsController->createView('Cake\Test\TestCase\View\TestView'); - $View->viewPath = $this->PostsController->name; - $View->view = 'cache_form'; + $View->templatePath($this->PostsController->name); + $View->template('cache_form'); $this->assertEquals('cache_form', $View->view); $result = $View->render(); @@ -1301,7 +1301,7 @@ public function testGetViewFileNameSubdirWithPluginAndViewPath() $this->PostsController->plugin = 'TestPlugin'; $this->PostsController->name = 'Posts'; $View = $this->PostsController->createView('Cake\Test\TestCase\View\TestView'); - $View->viewPath = 'Element'; + $View->templatePath('Element'); $pluginPath = TEST_APP . 'Plugin' . DS . 'TestPlugin' . DS; $result = $View->getViewFileName('sub_dir/sub_element'); $expected = $pluginPath . 'src' . DS . 'Template' . DS . 'Element' . DS . 'sub_dir' . DS . 'sub_element.ctp'; @@ -1320,7 +1320,7 @@ public function testViewVarOverwritingLocalHelperVar() $Controller->helpers = ['Html']; $Controller->set('html', 'I am some test html'); $View = $Controller->createView(); - $View->viewPath = $Controller->name; + $View->templatePath($Controller->name); $result = $View->render('helper_overwrite', false); $this->assertRegExp('/I am some test html/', $result); @@ -1335,7 +1335,7 @@ public function testViewVarOverwritingLocalHelperVar() public function testViewFileName() { $View = $this->PostsController->createView('Cake\Test\TestCase\View\TestView'); - $View->viewPath = 'Posts'; + $View->templatePath('Posts'); $result = $View->getViewFileName('index'); $this->assertRegExp('/Posts(\/|\\\)index.ctp/', $result); @@ -1838,7 +1838,7 @@ public function testMemoryLeakInPaths() $this->ThemeController->name = 'Posts'; $View = $this->ThemeController->createView(); - $View->viewPath = 'Posts'; + $View->templatePath('Posts'); $View->layout = 'whatever'; $View->theme = 'TestTheme'; $View->element('test_element');