Skip to content

PHPUnit 13.2 breaks Drupal's approach for ignoring deprecations #6705

@mondrake

Description

@mondrake
Q A
PHPUnit version 13.2.0
PHP version 8.5
Installation Method Composer

Summary

PHPUnit 13.2.0 breaks Drupal deprecation ignore process, that is based on the assumption that an error handler set in the bootstrap PHP file is the one active during the testing.

What we are doing in Drupal is we set in bootstrap the \Drupal\TestTools\ErrorHandler\BootstrapErrorHandler which itself falls back to PHPUnit's own one. So we can exclude some deprecations to be ignored (we ignore via a file containing a set of patterns to be ignored) and return to test execution without even letting PHPUnit know that a deprecation was triggered.

13.2 reverses that - it always sets its own error handler as the main one, and only falls back to \Drupal\TestTools\ErrorHandler\BootstrapErrorHandler after the error (including deprecation ones) have been already collected. So deprecations get through to PHPUnit and are reported.

Current behavior

How to reproduce

Expected behavior

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature/issuesIssues related to handling of `E_*` emitted by the PHP runtime and `E_USER_*` emitted in PHP codefeature/test-runnerCLI test runnertype/bugSomething is brokenversion/13Something affects PHPUnit 13

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions