Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I make PHPUnit fail if the code throws a notice?

Tags:

php

phpunit

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.

like image 461
Dean Rather Avatar asked Dec 05 '25 05:12

Dean Rather


2 Answers

function exception_error_handler($errno, $errstr, $errfile, $errline ) 
{
    throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
}
set_error_handler("exception_error_handler");
like image 74
Kornel Avatar answered Dec 09 '25 19:12

Kornel


You want to upgrade to a more recent version of PHPUnit, have a look at http://www.phpunit.de/.

like image 43
user84082 Avatar answered Dec 09 '25 20:12

user84082



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!