Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow regex patterns for @expectedExceptionMessage #1263

Closed
marcioAlmada opened this issue May 19, 2014 · 3 comments
Closed

Allow regex patterns for @expectedExceptionMessage #1263

marcioAlmada opened this issue May 19, 2014 · 3 comments

Comments

@marcioAlmada
Copy link
Contributor

I noticed some "pain" around this subject for a good amount of people so decided to propose to allow regex patterns for @expectedExceptionMessage.

This feature could keep test suites dryer when dealing with fuzzy exception messages while keeping consistency when test annotations are preferred. Ex:

/**
 * @expectedException ParserException
 * @expectedExceptionMessage /Cannot use \w+ as type \w+ (on line \d+)/
 * @dataProvider typeErrorProvider
 */
   public function testTypeError()
   { ...

Some dynamic exception messages that would pass the example test:

  • Cannot use 2 as type float (on line 2)
  • Cannot use sebastian as type integer (on line 14)
@marcioAlmada
Copy link
Contributor Author

PS: I could create a pull request if you think it's worth it.

@whatthejeff
Copy link
Contributor

I think it's a good idea. Let's see that PR :)

@whatthejeff
Copy link
Contributor

I've always wanted this feature. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants