Skip to content

Commit

Permalink
fix test to report exception via json with file name and line number
Browse files Browse the repository at this point in the history
  • Loading branch information
inoas committed Mar 10, 2017
1 parent 774b088 commit 703e288
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tests/TestCase/Error/ExceptionRendererTest.php
Expand Up @@ -430,6 +430,7 @@ public function testError400AsJson()
Router::setRequestInfo($request);

$exception = new NotFoundException('Custom message');
$execptionLine = __LINE__ - 1;
$ExceptionRenderer = new ExceptionRenderer($exception);
$ExceptionRenderer->controller->response = $this->getMockBuilder('Cake\Network\Response')
->setMethods(['statusCode', '_sendHeader'])
Expand All @@ -440,7 +441,9 @@ public function testError400AsJson()
$expected = [
'message' => 'Custom message',
'url' => '/posts/view/1000?sort=title&direction=desc',
'code' => 404
'code' => 404,
'file' => __FILE__,
'line' => $execptionLine
];

$this->assertEquals($expected, json_decode($result, true));
Expand Down

0 comments on commit 703e288

Please sign in to comment.