function JsonMatches::fail
Throws an exception for the given compared value and test description.
Throws
Overrides Constraint::fail
File
-
vendor/
phpunit/ phpunit/ src/ Framework/ Constraint/ JsonMatches.php, line 71
Class
- JsonMatches
- @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
Namespace
PHPUnit\Framework\ConstraintCode
protected function fail(mixed $other, string $description, ?ComparisonFailure $comparisonFailure = null) : never {
if ($comparisonFailure === null) {
[
$error,
$recodedOther,
] = Json::canonicalize($other);
if ($error) {
parent::fail($other, $description);
}
[
$error,
$recodedValue,
] = Json::canonicalize($this->value);
if ($error) {
parent::fail($other, $description);
}
$comparisonFailure = new ComparisonFailure(json_decode($this->value), json_decode($other), Json::prettify($recodedValue), Json::prettify($recodedOther), 'Failed asserting that two json values are equal.');
}
parent::fail($other, $description, $comparisonFailure);
}