Problem/Motivation

PHPUnit 13.2 deprecates TestCase::expectExceptionMessage() in favor of TestCase::expectExceptionMessageIs() (stricter) or TestCase::expectExceptionMessageIsOrContains() (equivalent to TestCase::expectExceptionMessage()).

See Improved API for exception message expectations

Proposed resolution

Replace additions that occurred recently.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3629594

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

mondrake created an issue. See original summary.

wkr1shna’s picture

Assigned: Unassigned » wkr1shna

Hey! i would love to give this a shot, Assigning this to myself!!

wkr1shna’s picture

Status: Active » Needs review

THe failed php builds seems out of scope and not related to my changes, Marking this for review!!

mondrake’s picture

Thank you @wkr1shna!

Sorry, I had already work done for this on #3574681: [Nov 2026] Introduce support for PHPUnit 13.5, so it's easier for me to dump it here rather then review your input. Let's restart from here.

If you are interested on getting PHPUnit 13 in Drupal, there's plenty of work to do! You can look at open issues tagged 'PHPUnit 13', or at the current failures of #3574681: [Nov 2026] Introduce support for PHPUnit 13.5 and open issues for the things that are failing.

wkr1shna’s picture

Assigned: wkr1shna » Unassigned

Thank you for the guidance! No worries at all. I’m definitely interested in contributing further to the PHPUnit 13 effort. I’ll go through the open issues and current failures to find something I can work on.

dcam’s picture

Status: Needs review » Reviewed & tested by the community

All of the code changes look correct. Observant reviewers may notice that there are a few instances where expectExceptionMessageIs() is already in use and the expected message is being changed. That's because those messages are incorrect. You have to test with PHPUnit 13.2+ to get those failures. The easiest way to do that is to install the MR from #3574681: [Nov 2026] Introduce support for PHPUnit 13.5, revert the changes to those tests, then run the tests. You'll get failures noting that the exception messages are incorrect.

I also grepped Core for any remaining instances of expectExceptionMessage(). The only two left are in ForwardCompatibilityTrait.

This looks good to me.