Browse Source

Refactored out the Heredoc syntax in favour of array comparison to remove potential non-matches due to json formatting

David Yell 9 years ago
parent
commit
2271b94bb3
1 changed files with 6 additions and 9 deletions
  1. 6 9
      tests/TestCase/Error/ExceptionRendererTest.php

+ 6 - 9
tests/TestCase/Error/ExceptionRendererTest.php

@@ -437,16 +437,13 @@ class ExceptionRendererTest extends TestCase
         $ExceptionRenderer->controller->response->expects($this->once())->method('statusCode')->with(404);
 
         $result = $ExceptionRenderer->render()->body();
+        $expected = [
+            'message' => 'Custom message',
+            'url' => '/posts/view/1000?sort=title&direction=desc',
+            'code' => 404
+        ];
 
-        $expected = <<<JSON
-{
-    "message": "Custom message",
-    "url": "\\/posts\\/view\\/1000?sort=title\\u0026amp;direction=desc",
-    "code": 404
-}
-JSON;
-
-        $this->assertTextEquals($expected, $result);
+        $this->assertEquals($expected, json_decode($result, true));
     }
 
     /**