MDL-77417 behat: behat_error_handler meets deprecation error types

Right now, any E_DEPRECATED, E_USER_DEPRECATED error type leads
to exception in behat runs, because the behat error handled is
not aware of them. See MDL-38041 for the initial implementation.

We don't want that to happen and they must behave like other "low"
error types (notices, warnings...), that will be reported in logs
or output, but won't trigger any exception, so the test can continue.

This commit just adds those 2 "new" error types to the handler,
providing the very same behaviour for them than the rest.
This commit is contained in:
Eloy Lafuente (stronk7) 2023-02-27 09:33:08 +01:00
parent 9ee4f8db8b
commit 2d0c0dbcb6

View File

@ -137,7 +137,7 @@ function behat_error_handler($errno, $errstr, $errfile, $errline) {
// set to DEVELOPER and will always include E_NOTICE,E_USER_NOTICE... as part of E_ALL, if the current
// error_reporting() value does not include one of those levels is because it has been forced through
// the moodle code (see fix_utf8() for example) in that cases we respect the forced error level value.
$respect = array(E_NOTICE, E_USER_NOTICE, E_STRICT, E_WARNING, E_USER_WARNING);
$respect = array(E_NOTICE, E_USER_NOTICE, E_STRICT, E_WARNING, E_USER_WARNING, E_DEPRECATED, E_USER_DEPRECATED);
foreach ($respect as $respectable) {
// If the current value does not include this kind of errors and the reported error is