Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
robertpustulka committed Nov 20, 2017
1 parent b5693d1 commit 05ad8e1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions tests/TestCase/View/JsonViewTest.php
Expand Up @@ -318,7 +318,7 @@ public function testRenderWithView()
$Request = new ServerRequest();
$Response = new Response();
$Controller = new Controller($Request, $Response);
$Controller->name = 'Posts';
$Controller->setName('Posts');

$data = [
'User' => [
Expand All @@ -332,7 +332,7 @@ public function testRenderWithView()
$Controller->set('user', $data);
$Controller->viewBuilder()->setClassName('Json');
$View = $Controller->createView();
$View->setTemplatePath($Controller->name);
$View->setTemplatePath($Controller->getName());
$output = $View->render('index');

$expected = json_encode(['user' => 'fake', 'list' => ['item1', 'item2'], 'paging' => null]);
Expand Down
24 changes: 12 additions & 12 deletions tests/TestCase/View/ViewTest.php
Expand Up @@ -1069,7 +1069,7 @@ public function testElementCache()
public function testViewEvent()
{
$View = $this->PostsController->createView();
$View->setTemplatePath($this->PostsController->name);
$View->setTemplatePath($this->PostsController->getName());
$View->enableAutoLayout(false);
$listener = new TestViewEventListenerInterface();

Expand Down Expand Up @@ -1178,7 +1178,7 @@ public function testInitialize()
public function testHelperCallbackTriggering()
{
$View = $this->PostsController->createView();
$View->setTemplatePath($this->PostsController->name);
$View->setTemplatePath($this->PostsController->getName());

$manager = $this->getMockBuilder('Cake\Event\EventManager')->getMock();
$View->setEventManager($manager);
Expand Down Expand Up @@ -1270,7 +1270,7 @@ public function testBeforeLayout()
'Html'
];
$View = $this->PostsController->createView();
$View->setTemplatePath($this->PostsController->name);
$View->setTemplatePath($this->PostsController->getName());
$View->render('index');
$this->assertEquals('Valuation', $View->helpers()->TestBeforeAfter->property);
}
Expand All @@ -1289,7 +1289,7 @@ public function testAfterLayout()
$this->PostsController->set('variable', 'values');

$View = $this->PostsController->createView();
$View->setTemplatePath($this->PostsController->name);
$View->setTemplatePath($this->PostsController->getName());

$content = 'This is my view output';
$result = $View->renderLayout($content, 'default');
Expand All @@ -1306,7 +1306,7 @@ public function testRenderLoadHelper()
{
$this->PostsController->helpers = ['Form', 'Number'];
$View = $this->PostsController->createView('Cake\Test\TestCase\View\TestView');
$View->setTemplatePath($this->PostsController->name);
$View->setTemplatePath($this->PostsController->getName());

$result = $View->render('index', false);
$this->assertEquals('posts index', $result);
Expand All @@ -1317,7 +1317,7 @@ public function testRenderLoadHelper()

$this->PostsController->helpers = ['Html', 'Form', 'Number', 'TestPlugin.PluggedHelper'];
$View = $this->PostsController->createView('Cake\Test\TestCase\View\TestView');
$View->setTemplatePath($this->PostsController->name);
$View->setTemplatePath($this->PostsController->getName());

$result = $View->render('index', false);
$this->assertEquals('posts index', $result);
Expand All @@ -1335,7 +1335,7 @@ public function testRenderLoadHelper()
public function testRender()
{
$View = $this->PostsController->createView('Cake\Test\TestCase\View\TestView');
$View->setTemplatePath($this->PostsController->name);
$View->setTemplatePath($this->PostsController->getName());
$result = $View->render('index');

$this->assertRegExp("/<meta charset=\"utf-8\"\/>\s*<title>/", $result);
Expand All @@ -1354,7 +1354,7 @@ public function testRender()
Configure::write('Cache.check', true);

$View = $this->PostsController->createView('Cake\Test\TestCase\View\TestView');
$View->setTemplatePath($this->PostsController->name);
$View->setTemplatePath($this->PostsController->getName());
$result = $View->render('index');

$this->assertRegExp("/<meta charset=\"utf-8\"\/>\s*<title>/", $result);
Expand All @@ -1369,7 +1369,7 @@ public function testRender()
public function testRenderUsingViewProperty()
{
$View = $this->PostsController->createView('Cake\Test\TestCase\View\TestView');
$View->setTemplatePath($this->PostsController->name);
$View->setTemplatePath($this->PostsController->getName());
$View->setTemplate('cache_form');

$this->assertEquals('cache_form', $View->getTemplate());
Expand Down Expand Up @@ -1407,7 +1407,7 @@ public function testRenderUsingLayoutArgument()
public function testGetViewFileNameSubdirWithPluginAndViewPath()
{
$this->PostsController->plugin = 'TestPlugin';
$this->PostsController->name = 'Posts';
$this->PostsController->setName('Posts');
$View = $this->PostsController->createView('Cake\Test\TestCase\View\TestView');
$View->setTemplatePath('Element');

Expand All @@ -1429,7 +1429,7 @@ public function testViewVarOverwritingLocalHelperVar()
$Controller->helpers = ['Html'];
$Controller->set('html', 'I am some test html');
$View = $Controller->createView();
$View->setTemplatePath($Controller->name);
$View->setTemplatePath($Controller->getName());
$result = $View->render('helper_overwrite', false);

$this->assertRegExp('/I am some test html/', $result);
Expand Down Expand Up @@ -1973,7 +1973,7 @@ public function testMemoryLeakInPaths()
{
$this->skipIf(env('CODECOVERAGE') == 1, 'Running coverage this causes this tests to fail sometimes.');
$this->ThemeController->plugin = null;
$this->ThemeController->name = 'Posts';
$this->ThemeController->setName('Posts');

$View = $this->ThemeController->createView();
$View->setTemplatePath('Posts');
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/View/XmlViewTest.php
Expand Up @@ -281,7 +281,7 @@ public function testRenderWithView()
$Request = new ServerRequest();
$Response = new Response();
$Controller = new Controller($Request, $Response);
$Controller->name = 'Posts';
$Controller->setName('Posts');

$data = [
[
Expand Down

0 comments on commit 05ad8e1

Please sign in to comment.