Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Constraint.php

function Constraint::fail

Throws an exception for the given compared value and test description.

Throws

ExpectationFailedException

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\Constraint

Code

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);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal