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
Esempio n. 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));
     }
 }
Esempio n. 2
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)
 {
     if (is_object($this->value) && is_object($other)) {
         return 'two variables reference the same object';
     }
     if (is_string($this->value) && is_string($other)) {
         return 'two strings are identical';
     }
     return parent::failureDescription($other);
 }
 /**
  * Adds compatibility to PHPUnit 3.6
  *
  * @param mixed $other
  * @return string
  */
 protected function failureDescription($other)
 {
     if (method_exists($this, 'customFailureDescription')) {
         return $this->customFailureDescription($other);
     }
     return parent::failureDescription($other);
 }
Esempio n. 4
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.
  *
  * To provide additional failure information additionalFailureDescription
  * can be used.
  *
  * @param  mixed $other Evaluated value or object.
  * @return string
  */
 protected function failureDescription($other)
 {
     return $this->constraint->failureDescription($other);
 }
Esempio n. 5
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.
  *
  * To provide additional failure information additionalFailureDescription
  * can be used.
  *
  * @param  mixed $other Evaluated value or object.
  * @return string
  */
 protected function failureDescription($other)
 {
     $nodeValue = $this->getNodeValue($other);
     return $this->constraint->failureDescription($nodeValue);
 }