Adding tests for previous commit.

Refs #1678
This commit is contained in:
mark_story 2011-05-16 21:12:28 -04:00
parent 2bc58a5abd
commit cd13e37609

View file

@ -636,4 +636,28 @@ class ExceptionRendererTest extends CakeTestCase {
sort($ExceptionRenderer->controller->helpers);
$this->assertEquals(array('Form', 'Html', 'Session'), $ExceptionRenderer->controller->helpers);
}
/**
* Test that exceptions can be rendered when an request hasn't been registered
* with Router
*
* @return void
*/
function testRenderWithNoRequest() {
Router::reload();
$this->assertNull(Router::getRequest(false));
$exception = new Exception('Terrible');
$ExceptionRenderer = new ExceptionRenderer($exception);
$ExceptionRenderer->controller->response = $this->getMock('CakeResponse', array('statusCode', '_sendHeader'));
$ExceptionRenderer->controller->response->expects($this->once())
->method('statusCode')
->with(500);
ob_start();
$ExceptionRenderer->render();
$result = ob_get_clean();
$this->assertContains('Internal Error', $result);
}
}