I may be wrong, but there's no way to expect an exception whose message matches a regular expression pattern. Reading the exception.php source code I found this comment: "This could be improved to accept a pattern expectation to test the error message, but that will have to come later."
Please, find attached 2 patches and a sample UnitTestCase
I didn't use a pattern expectation but an exception object whose message contains a regex pattern. It's not elegant, but it allows the exception type to be tested too.
Log in to post a comment.