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:
mark_story 2011-03-10 22:01:23 -05:00
parent ab4ce97cad
commit b292f4ffaa
3 changed files with 13 additions and 3 deletions

View file

@ -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;

View file

@ -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);

View file

@ -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);
}
/**