Commit 46e3464e authored by Ivan Chepurnyi's avatar Ivan Chepurnyi

Merge pull request #19 from vsushkov/constraint-evaluate-fix

Constraint evaluate fix for PHPUnit 3.6.x
parents 923ba924 0e77ecba
...@@ -149,12 +149,29 @@ abstract class EcomDev_PHPUnit_Constraint_Abstract ...@@ -149,12 +149,29 @@ abstract class EcomDev_PHPUnit_Constraint_Abstract
/** /**
* Evaluates value by type. * Evaluates value by type.
* (non-PHPdoc) *
* @see PHPUnit_Framework_Constraint::evaluate() * @see PHPUnit_Framework_Constraint::evaluate()
*
* @param mixed $other Value or object to evaluate.
* @param string $description Additional information about the test
* @param bool $returnResult Whether to return a result or throw an exception
* @return mixed
*/ */
public function evaluate($other) public function evaluate($other, $description = '', $returnResult = false)
{ {
return $this->callProtectedByType('evaluate', $other); $success = false;
if ($this->callProtectedByType('evaluate', $other)) {
$success = true;
}
if ($returnResult) {
return $success;
}
if (!$success) {
$this->fail($other, $description);
}
} }
/** /**
...@@ -215,4 +232,4 @@ abstract class EcomDev_PHPUnit_Constraint_Abstract ...@@ -215,4 +232,4 @@ abstract class EcomDev_PHPUnit_Constraint_Abstract
{ {
return $this->callProtectedByType('text'); return $this->callProtectedByType('text');
} }
} }
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment