mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Fixing tests that were failing due to missing methods, and changes in CakeRoute.
Making ExceptionRenderer pass in the current request to the controller constructor. This fixes fatal errors on PrivateActionExceptions.
This commit is contained in:
parent
ab4ce97cad
commit
b292f4ffaa
3 changed files with 13 additions and 3 deletions
|
@ -146,9 +146,9 @@ class ExceptionRenderer {
|
|||
|
||||
if ($__previousError != $exception) {
|
||||
$__previousError = $exception;
|
||||
$controller = new CakeErrorController();
|
||||
$controller = new CakeErrorController(Router::getRequest(false));
|
||||
} else {
|
||||
$controller = new Controller();
|
||||
$controller = new Controller(Router::getRequest(false));
|
||||
$controller->viewPath = 'errors';
|
||||
}
|
||||
return $controller;
|
||||
|
|
|
@ -147,6 +147,15 @@ class AuthTestController extends Controller {
|
|||
function admin_login() {
|
||||
}
|
||||
|
||||
/**
|
||||
* admin_add method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function admin_add() {
|
||||
}
|
||||
|
||||
/**
|
||||
* logout method
|
||||
*
|
||||
|
@ -916,6 +925,7 @@ class AuthTest extends CakeTestCase {
|
|||
$this->Auth->request->addParams(Router::parse($url));
|
||||
$this->Auth->request->query['url'] = ltrim($url, '/');
|
||||
$this->Auth->request->base = '';
|
||||
|
||||
Router::setRequestInfo($this->Auth->request);
|
||||
$this->Auth->initialize($this->Controller);
|
||||
|
||||
|
|
|
@ -356,7 +356,7 @@ class ExceptionRendererTest extends CakeTestCase {
|
|||
$result = ob_get_clean();
|
||||
|
||||
$this->assertPattern('/<h2>Custom message<\/h2>/', $result);
|
||||
$this->assertPattern("/<strong>'\/posts\/view\/1000'<\/strong>/", $result);
|
||||
$this->assertPattern("/<strong>'.*?\/posts\/view\/1000'<\/strong>/", $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue