sebastianbergmann/phpunit — pull request #1358 by marcioAlmada (2014-07-27 06:28:57+00:00)
Title: Patch for exception message regex

Change log:

- adds `@expectedExceptionMessageRegExp` annotation
- adds TestCase::setExpectedExceptionRegex($exceptionClass, $pattern, $code) so exception message regex is still a first class citizen
- recovers old behavior of `@expectedExceptionMessage`
- Both `@expectedExceptionMessage` and `@expectedExceptionMessageRegExp` can be used simultaneously
- No more ambiguity already discussed in #1328

Relates to: #1266 #1264 #1263

Things not exactly related to this PR that I think we could do better:

- I particulary don't like the redundancy of `TestCase::setExpectedException` vs `TestCase::setExpectedExceptionRegex`, but it was the only sane way to keep the feature since there are no granular methods like `TestCase::setExpectedExceptionMessage` or `TestCase::setExpectedExceptionCode`

- The way PHPUnit grabs annotation from doc blocks is spread across multiple methods at `Util\Test` class, and it can be kinda tricky to expand the API. There are many annotations libraries around, I recommend to pick one ;). I could make a PR for this in the future.