PHPUnit_Framework_Constraint::failureDescription PHP Method

failureDescription() protected method

The beginning of failure messages is "Failed asserting that" in most cases. This method should return the second part of that sentence. To provide additional failure information additionalFailureDescription can be used.
protected failureDescription ( mixed $other ) : string
$other mixed Evaluated value or object.
return string
    protected function failureDescription($other)
    {
        return $this->exporter->export($other) . ' ' . $this->toString();
    }

Usage Example

Example #1
0
 /**
  * Returns the description of the failure
  *
  * The beginning of failure messages is "Failed asserting that" in most
  * cases. This method should return the second part of that sentence.
  *
  * @param mixed $other Evaluated value or object.
  *
  * @return string
  */
 protected function failureDescription($other)
 {
     switch (get_class($this->constraint)) {
         case 'PHPUnit_Framework_Constraint_And':
         case 'PHPUnit_Framework_Constraint_Not':
         case 'PHPUnit_Framework_Constraint_Or':
             return 'not( ' . $this->constraint->failureDescription($other) . ' )';
         default:
             return self::negate($this->constraint->failureDescription($other));
     }
 }
All Usage Examples Of PHPUnit_Framework_Constraint::failureDescription