Skip to content

Commit

Permalink
Refactored out the Heredoc syntax in favour of array comparison to re…
Browse files Browse the repository at this point in the history
…move potential non-matches due to json formatting
  • Loading branch information
David Yell committed Feb 27, 2017
1 parent f597db4 commit 2271b94
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions tests/TestCase/Error/ExceptionRendererTest.php
Expand Up @@ -437,16 +437,13 @@ public function testError400AsJson()
$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));
}

/**
Expand Down

0 comments on commit 2271b94

Please sign in to comment.