sebastianbergmann/phpunit — Issue #468: Add ability to expect a specific exception without subclasses
Author: dharkness
Created: 2012-01-25 18:30:04+00:00
State: open

Sometimes you have to deal with bad legacy code or PHP internal code that throws an actual Exception class, and to test it you need to be able to expect it. To avoid having to use try/catch and get_class() in these cases, how about adding a simple way to indicate that you want only that specific exception class. Any subclasses would be ignored and fail the test. A single character prefix would work great.

/**
* @expectedException -Exception
*/