Skip to content

Commit

Permalink
Merge pull request #4608 from caswell-wc/jsonFragment_without_json
Browse files Browse the repository at this point in the history
assertJsonFragment fails gracefully with invalid json
  • Loading branch information
paulbalandan authored Apr 24, 2021
2 parents 92ee5c8 + 2a6ce84 commit 17ddb98
Show file tree
Hide file tree
Showing 3 changed files with 437 additions and 401 deletions.
3 changes: 2 additions & 1 deletion system/Test/TestResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,8 @@ public function getJSON()
*/
public function assertJSONFragment(array $fragment, bool $strict = false)
{
$json = json_decode($this->getJSON(), true);
$json = json_decode($this->getJSON(), true);
$this->assertIsArray($json, 'Response does not have valid json');
$patched = array_replace_recursive($json, $fragment);

if ($strict)
Expand Down
Loading

0 comments on commit 17ddb98

Please sign in to comment.