You are here

protected function PHPUnit_Framework_Constraint_ExceptionMessageRegExp::matches in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/phpunit/phpunit/src/Framework/Constraint/ExceptionMessageRegExp.php \PHPUnit_Framework_Constraint_ExceptionMessageRegExp::matches()

Evaluates the constraint for parameter $other. Returns true if the constraint is met, false otherwise.

Parameters

Exception $other:

Return value

bool

Overrides PHPUnit_Framework_Constraint::matches

File

vendor/phpunit/phpunit/src/Framework/Constraint/ExceptionMessageRegExp.php, line 37

Class

PHPUnit_Framework_Constraint_ExceptionMessageRegExp
@since Class available since Release 4.3.0

Code

protected function matches($other) {
  $match = PHPUnit_Util_Regex::pregMatchSafe($this->expectedMessageRegExp, $other
    ->getMessage());
  if (false === $match) {
    throw new PHPUnit_Framework_Exception("Invalid expected exception message regex given: '{$this->expectedMessageRegExp}'");
  }
  return 1 === $match;
}