Browse Source

fix test to report exception via json with file name and line number

inoas 9 years ago
parent
commit
703e2885ba
1 changed files with 4 additions and 1 deletions
  1. 4 1
      tests/TestCase/Error/ExceptionRendererTest.php

+ 4 - 1
tests/TestCase/Error/ExceptionRendererTest.php

@@ -430,6 +430,7 @@ class ExceptionRendererTest extends TestCase
         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'])
@@ -440,7 +441,9 @@ class ExceptionRendererTest extends TestCase
         $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));