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

Command icon 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:

Comments

mstrelan created an issue. See original summary.

mstrelan’s picture

Status: Active » Needs review
mondrake’s picture

Here 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.

mstrelan’s picture

Well the instance method will return a singleton so there's no new instance.

mondrake’s picture

Status: Needs review » Reviewed & tested by the community

Right!

  • xjm committed 3232e588 on 11.x
    Issue #3445896 by mstrelan, mondrake: PHPUnit\Runner\ErrorHandler::...
xjm’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: +Portland2024

Checked and confirmed that this method does not exist in PHPUnit 9, so this is an 11.x-only change.

Committed to 11.x. Thanks!

  • xjm committed 3927c703 on 11.0.x
    Issue #3445896 by mstrelan, mondrake: PHPUnit\Runner\ErrorHandler::...

xjm’s picture

Version: 11.x-dev » 11.0.x-dev

(Branch sorting is slightly weird now that 11.x is open.)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.