You are here

protected function PHPUnit_Framework_Constraint_IsJson::failureDescription in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/phpunit/phpunit/src/Framework/Constraint/IsJson.php \PHPUnit_Framework_Constraint_IsJson::failureDescription()

Returns the description of the failure

The beginning of failure messages is "Failed asserting that" in most cases. This method should return the second part of that sentence.

Parameters

mixed $other Evaluated value or object.:

Return value

string

Overrides PHPUnit_Framework_Constraint::failureDescription

File

vendor/phpunit/phpunit/src/Framework/Constraint/IsJson.php, line 44

Class

PHPUnit_Framework_Constraint_IsJson
Constraint that asserts that a string is valid JSON.

Code

protected function failureDescription($other) {
  json_decode($other);
  $error = PHPUnit_Framework_Constraint_JsonMatches_ErrorMessageProvider::determineJsonError(json_last_error());
  return sprintf('%s is valid JSON (%s)', $this->exporter
    ->shortenedExport($other), $error);
}