Problem/Motivation
In core/tests/bootstrap.php we currently have the following code:
set_error_handler(new BootstrapErrorHandler(new PhpUnitErrorHandler()));
Where PhpUnitErrorHandler is an alias for PHPUnit\Runner\ErrorHandler.
Since PHPUnit 11.1.0 the constructor for PHPUnit\Runner\ErrorHandler is marked private, and we get the following error:
Error in bootstrap script: Error:
Call to private PHPUnit\Runner\ErrorHandler::__construct() from scope PHPUnit\TextUI\Application
Steps to reproduce
Proposed resolution
Call PHPUnit\Runner\ErrorHandler::instance() instead.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Issue fork drupal-3445896
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3445896-phpunit-error-handler
changes, plain diff MR !7956
Comments
Comment #3
mstrelan commentedComment #4
mondrakeHere I would like to check what is the error handler at that point: if it’s already set to PHPUnit’s one we probably do not need to create a nee instance.
Comment #5
mstrelan commentedWell the instance method will return a singleton so there's no new instance.
Comment #6
mondrakeRight!
Comment #8
xjmChecked and confirmed that this method does not exist in PHPUnit 9, so this is an 11.x-only change.
Committed to 11.x. Thanks!
Comment #11
xjm(Branch sorting is slightly weird now that 11.x is open.)