问题
It doesn't appear to do it by default, and I don't see any switch for it either.
This is PHPUnit 2.3.5, and PHP 5.2.0-8.
回答1:
You want to upgrade to a more recent version of PHPUnit, have a look at http://www.phpunit.de/.
回答2:
function exception_error_handler($errno, $errstr, $errfile, $errline )
{
throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
}
set_error_handler("exception_error_handler");
回答3:
Your available option appears to be using set_error_handler() to override the error process (PHPUnit installs its own, which you'd be replacing). Then you'd either duplicate what PHPUnit's error handler does, except triggering failure on E_NOTICEs, or hand off to PHPUnit's error handler (which you'll get a handle to returned from set_error_handler()) and fake up E_NOTICES as something more critical.
来源:https://stackoverflow.com/questions/679854/can-i-make-phpunit-fail-if-the-code-throws-a-notice