mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 17:16:18 +00:00
parent
2bc58a5abd
commit
cd13e37609
1 changed files with 24 additions and 0 deletions
|
@ -636,4 +636,28 @@ class ExceptionRendererTest extends CakeTestCase {
|
||||||
sort($ExceptionRenderer->controller->helpers);
|
sort($ExceptionRenderer->controller->helpers);
|
||||||
$this->assertEquals(array('Form', 'Html', 'Session'), $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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue