sebastianbergmann/phpunit — Issue #487: PHPUnit_Util_ErrorHandler on __toString()
Author: adlawson
Created: 2012-02-05 19:27:41+00:00
State: open

@see https://github.com/sebastianbergmann/phpunit/blob/3.6/PHPUnit/Util/ErrorHandler.php#L97-101

I see no reason why the `__toString` method should be the only method not included in the default error handling behaviour.

I know `__toString` cannot throw an exception itself, which is why it is the one place it is actually necessary to trigger an error rather than throw an exception. This, however, doesn't mean that the PHPUnit can't handle it in just the same way it does everything else.

To fully test `__toString` methods, I've extended `PHPUnit_Util_ErrorHandler` to essentially remove the lines highlighted above and used that where it's needed.

The desired outcome would be to simply remove the lines highlighted to allow testing `__toString` methods. Failing that, it should at least be highlighted in the documentation that the 'default' behaviour does not apply to `__toString`.

I'm happy to submit the changes, but I'd like to keep the ticket open for discussion beforehand.