Skip to content

Commit

Permalink
Fix more usage of deprecated methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Apr 25, 2018
1 parent f076f59 commit 15e61cb
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 22 deletions.
Expand Up @@ -524,8 +524,8 @@ public function testNoViewClassExtension()
return $this->Controller->response;
});
$this->Controller->render();
$this->assertEquals('RequestHandlerTest' . DS . 'csv', $this->Controller->viewBuilder()->templatePath());
$this->assertEquals('csv', $this->Controller->viewBuilder()->layoutPath());
$this->assertEquals('RequestHandlerTest' . DS . 'csv', $this->Controller->viewBuilder()->getTemplatePath());
$this->assertEquals('csv', $this->Controller->viewBuilder()->getLayoutPath());
}

/**
Expand Down Expand Up @@ -851,9 +851,9 @@ public function testRenderAs()
{
$this->RequestHandler->renderAs($this->Controller, 'rss');

$this->Controller->viewBuilder()->templatePath('request_handler_test\\rss');
$this->Controller->viewBuilder()->setTemplatePath('request_handler_test\\rss');
$this->RequestHandler->renderAs($this->Controller, 'js');
$this->assertEquals('request_handler_test' . DS . 'js', $this->Controller->viewBuilder()->templatePath());
$this->assertEquals('request_handler_test' . DS . 'js', $this->Controller->viewBuilder()->getTemplatePath());
}

/**
Expand Down Expand Up @@ -916,12 +916,12 @@ public function testRenderAsCalledTwice()
$this->Controller->render();

$this->RequestHandler->renderAs($this->Controller, 'print');
$this->assertEquals('RequestHandlerTest' . DS . 'print', $this->Controller->viewBuilder()->templatePath());
$this->assertEquals('print', $this->Controller->viewBuilder()->layoutPath());
$this->assertEquals('RequestHandlerTest' . DS . 'print', $this->Controller->viewBuilder()->getTemplatePath());
$this->assertEquals('print', $this->Controller->viewBuilder()->getLayoutPath());

$this->RequestHandler->renderAs($this->Controller, 'js');
$this->assertEquals('RequestHandlerTest' . DS . 'js', $this->Controller->viewBuilder()->templatePath());
$this->assertEquals('js', $this->Controller->viewBuilder()->layoutPath());
$this->assertEquals('RequestHandlerTest' . DS . 'js', $this->Controller->viewBuilder()->getTemplatePath());
$this->assertEquals('js', $this->Controller->viewBuilder()->getLayoutPath());
}

/**
Expand Down
12 changes: 6 additions & 6 deletions tests/TestCase/Controller/ControllerTest.php
Expand Up @@ -393,12 +393,12 @@ public function testRender()
]);

$Controller = new Controller($request, new Response());
$Controller->viewBuilder()->templatePath('Posts');
$Controller->viewBuilder()->setTemplatePath('Posts');

$result = $Controller->render('index');
$this->assertRegExp('/posts index/', (string)$result);

$Controller->viewBuilder()->template('index');
$Controller->viewBuilder()->setTemplate('index');
$result = $Controller->render();
$this->assertRegExp('/posts index/', (string)$result);

Expand All @@ -421,7 +421,7 @@ public function testRenderViewChangesResponse()
]);

$controller = new Controller($request, new Response());
$controller->viewBuilder()->templatePath('Posts');
$controller->viewBuilder()->setTemplatePath('Posts');

$result = $controller->render('header');
$this->assertContains('header template', (string)$result);
Expand Down Expand Up @@ -950,7 +950,7 @@ public function testViewPathConventions()
return $e->getSubject()->response;
});
$Controller->render();
$this->assertEquals('Admin' . DS . 'Posts', $Controller->viewBuilder()->templatePath());
$this->assertEquals('Admin' . DS . 'Posts', $Controller->viewBuilder()->getTemplatePath());

$request = $request->withParam('prefix', 'admin/super');
$response = $this->getMockBuilder('Cake\Http\Response')->getMock();
Expand All @@ -959,7 +959,7 @@ public function testViewPathConventions()
return $e->getSubject()->response;
});
$Controller->render();
$this->assertEquals('Admin' . DS . 'Super' . DS . 'Posts', $Controller->viewBuilder()->templatePath());
$this->assertEquals('Admin' . DS . 'Super' . DS . 'Posts', $Controller->viewBuilder()->getTemplatePath());

$request = new ServerRequest([
'url' => 'pages/home',
Expand All @@ -972,7 +972,7 @@ public function testViewPathConventions()
return $e->getSubject()->response;
});
$Controller->render();
$this->assertEquals('Pages', $Controller->viewBuilder()->templatePath());
$this->assertEquals('Pages', $Controller->viewBuilder()->getTemplatePath());
}

/**
Expand Down
4 changes: 2 additions & 2 deletions tests/TestCase/Error/ExceptionRendererTest.php
Expand Up @@ -763,8 +763,8 @@ function (Event $event) {
$this->assertEquals('text/html', $response->getType());
$this->assertContains('Not Found', (string)$response->getBody());
$this->assertTrue($this->called, 'Listener added was not triggered.');
$this->assertEquals('', $ExceptionRenderer->controller->viewBuilder()->layoutPath());
$this->assertEquals('Error', $ExceptionRenderer->controller->viewBuilder()->templatePath());
$this->assertEquals('', $ExceptionRenderer->controller->viewBuilder()->getLayoutPath());
$this->assertEquals('Error', $ExceptionRenderer->controller->viewBuilder()->getTemplatePath());
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/Mailer/EmailTest.php
Expand Up @@ -2880,7 +2880,7 @@ public function testJsonSerialize()

$this->Email->viewBuilder()
->setTemplate('default')
->layout('test');
->setLayout('test');

$result = json_decode(json_encode($this->Email), true);
$this->assertContains('test', $result['viewVars']['exception']);
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/Mailer/MailerTest.php
Expand Up @@ -195,7 +195,7 @@ public function testDefaultProfileRestoration()
->with('foo', 'bar');

$mailer->send('test', ['foo', 'bar']);
$this->assertEquals('cakephp', $mailer->viewBuilder()->template());
$this->assertEquals('cakephp', $mailer->viewBuilder()->getTemplate());
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/Mailer/Transport/SmtpTransportTest.php
Expand Up @@ -364,7 +364,7 @@ public function testRcptWithReturnPath()
$email = new Email();
$email->setFrom('noreply@cakephp.org', 'CakePHP Test');
$email->setTo('cake@cakephp.org', 'CakePHP');
$email->returnPath('pleasereply@cakephp.org', 'CakePHP Return');
$email->setReturnPath('pleasereply@cakephp.org', 'CakePHP Return');

$this->socket->expects($this->at(0))->method('write')->with("MAIL FROM:<pleasereply@cakephp.org>\r\n");
$this->socket->expects($this->at(1))->method('read')->will($this->returnValue("250 OK\r\n"));
Expand Down
4 changes: 2 additions & 2 deletions tests/test_app/TestApp/Error/TestAppsExceptionRenderer.php
Expand Up @@ -23,10 +23,10 @@ protected function _getController()
$response = new Response();
try {
$controller = new TestAppsErrorController($request, $response);
$controller->viewBuilder()->layout('banana');
$controller->viewBuilder()->setLayout('banana');
} catch (\Exception $e) {
$controller = new Controller($request, $response);
$controller->viewBuilder()->templatePath('Error');
$controller->viewBuilder()->setTemplatePath('Error');
}

return $controller;
Expand Down
2 changes: 1 addition & 1 deletion tests/test_app/TestApp/Mailer/TestMailer.php
Expand Up @@ -29,7 +29,7 @@ public function getEmailForAssertion()

public function reset()
{
$this->template = $this->viewBuilder()->template();
$this->template = $this->viewBuilder()->getTemplate();

return parent::reset();
}
Expand Down

0 comments on commit 15e61cb

Please sign in to comment.