PHPUnit_Framework_Constraint::fail PHP Method

fail() protected method

Throws an exception for the given compared value and test description
protected fail ( mixed $other, string $description, SebastianBergmann\Comparator\ComparisonFailure $comparisonFailure = null )
$other mixed Evaluated value or object.
$description string Additional information about the test
$comparisonFailure SebastianBergmann\Comparator\ComparisonFailure
    protected function fail($other, $description, SebastianBergmann\Comparator\ComparisonFailure $comparisonFailure = null)
    {
        $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 PHPUnit_Framework_ExpectationFailedException($failureDescription, $comparisonFailure);
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * @param   mixed   $other The value passed to evaluate() which failed the
  *                         constraint check.
  * @param   string  $description A string with extra description of what was
  *                               going on while the evaluation failed.
  * @param   boolean $not Flag to indicate negation.
  * @throws  PHPUnit_Framework_ExpectationFailedException
  */
 public function fail($other, $description, $not = FALSE)
 {
     if (count($this->constraint) == 1 || $this->constraint instanceof PHPUnit_Framework_Constraint_Attribute) {
         $this->constraint->fail($other, $description, TRUE);
     } else {
         parent::fail($other, $description, !$not);
     }
 }
All Usage Examples Of PHPUnit_Framework_Constraint::fail