Problem/Motivation
PHPUnit 10 is out of bugfix support. Drupal core 11.2 is being tested with PHPUnit 11, but retained (albeit with some difficulty) allowing downgrading to PHPUnit 10. Current (Sep 2025) PHPUnit release is 12, and 13 is expected in 5 months.
Some issues already are introducing PHPUnit 11+ features and are blocked by the PHPUnit 10 BC.
Proposed resolution
Drop support for PHPUnit 10. This involves removing the compatibility layers so once done, neither core nor contrib will be able to run tests under PHPUnit 10.
Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
Framework support for testing with PHPUnit 10 is removed. Both core and contrib can now only run tests with PHPUnit 11.
Test classes using annotation metadata still work under PHPUnit 11, but throw PHPUnit deprecations that lead to CI job failures if appropriately set up. It is strongly recommended to convert annotations to attributes as described in Tests with PHPUnit 10 attributes are now supported.
| Comment | File | Size | Author |
|---|
Issue fork drupal-3537104
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:
- 3537104-remove-support-for
changes, plain diff MR !13167
Comments
Comment #2
godotislateFollowing up from #3531287: Remove core/recommended constraint for sebastian/diff here: with PHP10 support removed, consider restoring the core-recommended composer.json constraint on
sebastian/diff.Comment #4
mondrakeComment #5
mondrakeComment #6
mondrakeComment #7
mondrakeComment #8
mondrakeNot sure about #2. If we readd here, we may need to remove again in a few months while adjusting for PHPUnit 12.
Comment #9
longwaveI asked in #maintainers in Slack, and those who responded were largely unaware that we had moved to PHPUnit 11 even, but their code was still working fine, or they had had to make minimal changes. I think we should give it a few more days but it seems so far that dropping PHPUnit 10 support won't be a problem even though it is technically a BC break.
I will credit those who contributed to the discussion, but will wait a few more days for any more responses before removing the RM review tag.
Comment #10
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #11
mondrakerebased
Comment #12
longwaveOnly one further comment was received, agreeing that they had not noticed any difference with PHPUnit 11. Given there has been no disagreement to the plan I think it's fine to move forwards with this.
Comment #13
mondrakeAdded draft CR https://www.drupal.org/node/3546970, bare bone.
Comment #14
mondrakeHere's the Slack conversation FTR https://drupal.slack.com/archives/CJ93UNJP4/p1757068820842759
Comment #15
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #16
mondrakeComment #17
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #18
mondrakeComment #19
godotislateMR is pretty straightforward. At first I wondered about moving the following outside the loop, but I think it's actually more efficient this way. I guess this technically could be converted to an arrow function, but that's a person code style preference thing
I searched through the existing 11.x codebase for
/phpunit.?10/, and I found a few references that might need updating:composer/Generator/Builder/DrupalCoreRecommendedBuilder.php:
I think this one was addressed in #8, which makes sense, but then this @todo and @see needs to be edited or removed.
core/tests/Drupal/Tests/Component/PhpStorage/FileStorageTest.php:
// PHPUnit 10 cannot expect warnings, so we have to catch them ourselves.core/tests/Drupal/Tests/Core/Theme/Icon/IconFinderTest.php:
core/tests/Drupal/TestTools/Extension/DeprecationBridge/DeprecationHandler.php:
core/tests/Drupal/TestTools/Extension/DeprecationBridge/ExpectDeprecationTrait.php:
Also looked at the CR, which looks mostly fine, but I think this sentence is not clear.
Comment #20
mondrakeThanks a lot for the review. I'll be addressing the points in #19.
Anyway, let's postpone on #3547173: Complete test annotations to attributes conversion for all remaining tests that is completing the transition from annotation to attributes, and is tagged for avoiding commit conflicts.
Comment #21
mondrakeAddressed feedback in #19 and edited the draft CR, hopefully for the good.
Comment #22
mondrakeComment #23
godotislateI think the MR and CR look good now. Once unpostponed, should be good for RTBC unless there are significant rebase issues.
Comment #24
mondrakeUnblocked
Comment #25
godotislatelgtm
Comment #26
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #27
mondrakerebased - any dependency update will cause merge errors here, unfortunately
Comment #28
mondrakeComment #30
catchI think @longwave's slack survey in #9 is the best we can do here and more than a month has passed.
Committed/pushed to 11.x and cherry-picked to 11.3.x, thanks!
Comment #33
catchComment #35
mondrakeAdding a release snippet in case it's needed
Comment #36
catchAdded to the release notes draft https://docs.google.com/document/d/1YOayaWh5qf6ilLpnQtD36AovZ6ii4_9ssdmi...
Release notes are mainly for site owners, but some do have phpunit tests and we don't have a long list of release notes at the moment.