Skip to content

Commit

Permalink
Update tests to use new methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed Aug 16, 2015
1 parent d4da3e7 commit 1c204b7
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions tests/TestCase/View/ViewTest.php
Expand Up @@ -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');
Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
Expand All @@ -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');
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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("/<meta http-equiv=\"Content-Type\" content=\"text\/html; charset=utf-8\"\/>\s*<title>/", $result);
Expand All @@ -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);
Expand All @@ -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();
Expand All @@ -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';
Expand All @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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');
Expand Down

0 comments on commit 1c204b7

Please sign in to comment.