Skip to content

Commit

Permalink
add ability to pretty print response
Browse files Browse the repository at this point in the history
it is very difficult to view the failure response, since everything is
printed inline.  this allows the options to ‘pretty print’ the JSON
output, just like is done in the ‘additional info’.
  • Loading branch information
browner12 committed Mar 16, 2017
1 parent ecfddaf commit 420609a
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function failureDescription($table)
{
return sprintf(
"a row in the table [%s] matches the attributes %s.\n\n%s",
$table, $this->toString(), $this->getAdditionalInfo($table)
$table, $this->toString(JSON_PRETTY_PRINT), $this->getAdditionalInfo($table)
);
}

Expand Down Expand Up @@ -93,10 +93,11 @@ protected function getAdditionalInfo($table)
/**
* Get a string representation of the object.
*
* @param int $options
* @return string
*/
public function toString()
public function toString($options = 0)
{
return json_encode($this->data);
return json_encode($this->data, $options);
}
}

0 comments on commit 420609a

Please sign in to comment.