protected function PHPUnit_Framework_Constraint_JsonMatches::matches in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/phpunit/phpunit/src/Framework/Constraint/JsonMatches.php \PHPUnit_Framework_Constraint_JsonMatches::matches()
Evaluates the constraint for parameter $other. Returns true if the constraint is met, false otherwise.
This method can be overridden to implement the evaluation algorithm.
Parameters
mixed $other Value or object to evaluate.:
Return value
bool
Overrides PHPUnit_Framework_Constraint::matches
File
- vendor/
phpunit/ phpunit/ src/ Framework/ Constraint/ JsonMatches.php, line 43
Class
- PHPUnit_Framework_Constraint_JsonMatches
- Asserts whether or not two JSON objects are equal.
Code
protected function matches($other) {
$decodedOther = json_decode($other);
if (json_last_error()) {
return false;
}
$decodedValue = json_decode($this->value);
if (json_last_error()) {
return false;
}
return $decodedOther == $decodedValue;
}