Fixed
Project:
Drupal core
Version:
12.0.x-dev
Component:
phpunit
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
9 Oct 2026 at 08:12 UTC
Updated:
28 Oct 2026 at 06:01 UTC
Jump to comment: Most recent
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
Replace additions that occurred recently.
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
Comment #2
wkr1shna commentedHey! i would love to give this a shot, Assigning this to myself!!
Comment #4
wkr1shna commentedTHe failed php builds seems out of scope and not related to my changes, Marking this for review!!
Comment #5
mondrakeThank 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.
Comment #6
wkr1shna commentedThank 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.
Comment #7
dcam commentedAll 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 inForwardCompatibilityTrait.This looks good to me.
Comment #9
mstrelan commentedCommitted and pushed 6cc7ccc7e21 to main. Thanks!
Comment #11
mondrakeThis would need a backport to 12.0 for #3574681: [Nov 2026] Introduce support for PHPUnit 13.5.
Comment #12
mstrelan commentedComment #13
mstrelan commentedFYI this doesn't backport cleanly so will need a new MR:
Comment #15
mondrakeBackport. There have been a couple of commits that were
mainonly, and the MR for main was including fixes for those, that are missing in 12.0.x.Comment #16
dcam commentedI diffed the two MR plain diffs. Like @mondrake said, the only differences between the two are changes made in main that weren't backported to 12.0.x. This looks good.
I also didn't find any extra instances of
expectExceptionMessage()with grep.Comment #18
mstrelan commentedCommitted ff5b07e and pushed to 12.0.x. Thanks!