-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEATURE] Make suppressed error levels for ErrorHandler configurable
PHPUnit v10 changed how it handles notices, warnings, errors and deprecations. Therefore, converting them to exception has been removed in favour of display/fail options per type. Recently, the last missing piece for notices and deprecation has been added with: #5196: Optionally (fail|stop) on (notice|deprecation) events PHPUnit v9 (and possibly earlier versions) did not converted suppressed error levels to exceptions, if the corresponded old and removed option has been set. With PHPUnit v10, only native PHP error level (notices/strict,warnings,deprecated) are not handled if suppressed using the "@" suppress operator or by `error_reporting()` configuration. User error levels (notices,warnings,deprecation,error) are no longer suppressable. It's impossible to have only one defined set, which should be suppressable AND suppressed state regonized to suite all needs for framework, packages and applications using PHPUnit to test things. This **must** be configurable for users of the PHPUnit. This change adds configuration options to configure, which error levels are suppressable/suppressed state taking into account. Configuration is only provided through the PHPUnit configuration file. CLI options would not be really usefull, due "true" defauls - and therefore some options would be needed to be added "inverse". Having this only as XML options is more then suitable. Added xml configuration file options for: * (bool) errorHandlerIgnoreSuppressedPhpDeprecations [default: true] * (bool) errorHandlerIgnoreSuppressedPhpNotices [default: true] * (bool) errorHandlerIgnoreSuppressedPhpWarnings [default: true] * (bool) errorHandlerIgnoreSuppressedUserDeprecations [default: false] * (bool) errorHandlerIgnoreSuppressedUserNotices [default: false] * (bool) errorHandlerIgnoreSuppressedUserWarnings [default: false] **NOTE** ErrorLevels, which are configured to be ignored if suppressed, will not fail with corresponding `--fail-on-*` configuration/flag. On the other hand, this means that if suppressed ignore is configured, it will fail even if suppressed. E_USER_ERROR, e.g. triggered by using `trigger_error('', E_USER_ERROR)`, are not failing like php errors (E_ERROR). They always dispatches corresponding event. Additionally, there is no `--fail-on-error` flag which could control this for E_USER_ERROR. Therefore, E_USER_ERROR is left for now and should be targeted in a dedicated change. Furthermore, a couple of tests are added to cover the new options. Resolves #5302
- Loading branch information
Showing
41 changed files
with
1,153 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.