PHP Errors: But What if I WANT to Continue?
- Define an error handler
- Compares the current error to ones it is told to expect
-
If it is expected set
expected_error_list
to true
abstract class TestCase extends PHPUnit_Framework_TestCase { public function expected_errors_handler($errno, $errstr) { foreach ($this->expected_error_list as $expect) { if (strpos($errstr, $expect) !== false) { $this->expected_errors_found = true; return true; } } return false; } }