function Constraint::fail
Throws an exception for the given compared value and test description.
Throws
5 calls to Constraint::fail()
- Constraint::evaluate in vendor/
phpunit/ phpunit/ src/ Framework/ Constraint/ Constraint.php - Evaluates the constraint for parameter $other.
- IsIdentical::evaluate in vendor/
phpunit/ phpunit/ src/ Framework/ Constraint/ IsIdentical.php - Evaluates the constraint for parameter $other.
- JsonMatches::fail in vendor/
phpunit/ phpunit/ src/ Framework/ Constraint/ JsonMatches.php - Throws an exception for the given compared value and test description.
- JsonMatches::fail in vendor/
phpunit/ phpunit/ src/ Framework/ Constraint/ JsonMatches.php - Throws an exception for the given compared value and test description.
- TraversableContainsOnly::evaluate in vendor/
phpunit/ phpunit/ src/ Framework/ Constraint/ Traversable/ TraversableContainsOnly.php - Evaluates the constraint for parameter $other.
1 method overrides Constraint::fail()
- JsonMatches::fail in vendor/
phpunit/ phpunit/ src/ Framework/ Constraint/ JsonMatches.php - Throws an exception for the given compared value and test description.
File
-
vendor/
phpunit/ phpunit/ src/ Framework/ Constraint/ Constraint.php, line 89
Class
- Constraint
- @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 {
$failureDescription = sprintf('Failed asserting that %s.', $this->failureDescription($other));
$additionalFailureDescription = $this->additionalFailureDescription($other);
if ($additionalFailureDescription) {
$failureDescription .= "\n" . $additionalFailureDescription;
}
if (!empty($description)) {
$failureDescription = $description . "\n" . $failureDescription;
}
throw new ExpectationFailedException($failureDescription, $comparisonFailure);
}