Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Follow-up to #3106075: Bump minimum PHP for Drupal 9 to PHP 7.3, where we are bumping the minimum PHP version to 7.3.
Since we are already using PHPUnit 7 on PHP 7.3 in D8 and D9, PHPUnit 6 would no longer be used for testing in D9.
Proposed resolution
Drop PHPUnit 6 from D9, and reduce the PHPUnit compatibility layer to the minimum necessary to allow later support of PHPUnit 8.
Remaining tasks
Review patch.
User interface changes
None
API changes
None
Data model changes
None
Release notes snippet
PHPUnit has been upgraded to version 7 which is the earliest version that supports PHP 7.3, the minimum requirement for Drupal 9.
Comment | File | Size | Author |
---|---|---|---|
#9 | 3106918-9.patch | 53.82 KB | longwave |
Comments
Comment #2
mondrakeComment #3
mondrakeComment #4
mondrake#3106075: Bump minimum PHP for Drupal 9 to PHP 7.3 got committed, so this can be worked on now. It requires an update of the composer.lock file.
Comment #5
mondrakeAdding related issue.
Comment #6
longwaveComment #7
mondrakeNote: I deliberately kept the
\Drupal\Core\Composer\Composer::upgradePHPUnit
and::upgradePHPUnitCheck
methods introduced in #2950132: Support PHPUnit 7 optionally in Drupal 8, while keeping support for ^6.5 in order to be able to reuse them in the future for PHPUnit 8 and later.Comment #8
mondrakeComment #9
longwaveRebased against 9.0.x.
Comment #10
longwaveReparenting this as the old parent is now closed.
Comment #11
DamienMcKennaTagging as a requirement for Drupal 9.0-beta1.
Comment #12
Gábor HojtsyWhat is still left here? No steps listed in the summary. The patch looks good to me but have not enough experience for sure to confidently say its RTBC :)
Comment #13
Gábor HojtsyThere is a significant overlap with #3109261: Update composer dependencies on 9.0.x following PHP 7.3 requirement and this is one of two remaining backend dependency issues for the beta. Woot :)
Comment #14
longwaveUpdated IS. This does overlap, as the patch here was created before that other issue; this one only upgrades PHPUnit and immediate dependencies but also removes the PHPUnit 6 compatibility layer. Technically we could upgrade without removing the layer but it would leave dead code behind. Therefore both issues/patches are needed but one will require reroll depending on which gets in first :)
Comment #15
Gábor HojtsyMakes sense. We can do this first :) What is still left here other than reviews?
Comment #16
mondrakeMaybe this could use a review by a framework manager, mainly for what "remains" of the compatibility layer and of the PHPUnit check/upgrade logic.
Other then that, RTBC anyone?
Comment #17
Gábor HojtsyComment #18
xjmShouldn't we be going to PHPUnit 8?
Comment #19
longwave@xjm We surely will eventually but that requires at least #3107732: Add return typehints to setUp/tearDown methods in concrete test classes first which is a huge BC break, and probably some other fixes on top. I think this can be moved forward in parallel, especially as PHPUnit 6 isn't even used any more; this is all dead code.
Comment #20
Gábor HojtsyThe PHPUnit 8 support issue is at #3063887: Support PHPUnit 8 in Drupal 9, drop support for PHPUnit 7 btw :)
Comment #21
mondrake#20 yes, but that one will be significantly impacted if this issue + #3107732: Add return typehints to setUp/tearDown methods in concrete test classes will be committed to D9. At that point, PHPUnit 8 support in D9 would be basically only one blocker (#3094151: ExpectDeprecationTrait is not compatible with PHPUnit 8) away. But to be clear, in such case backporting PHPUnit 8 support to D8 would become rather complex.
EDIT -
and BTW, much, much simpler...
Comment #22
alexpottCommitted 53b4bf9 and pushed to 9.0.x. Thanks!
If we need to re-implement so of this to support future versions of PHPUnit so be it. We'll do that as necessary. I think we have way more important things to do than to try to backport PHPUnit 8 to Drupal 8 and this nicely unblocks Drupal 9 from moving to PHPUnit 8.
Comment #24
jibranShould we have not removed
as well?
Comment #25
mondrake@jibran see #7. We will need the mechanism in the future any time we may want to support multiple versions of PHPUnit. PHPUnit 9 is due out in a week from now, and we may want to try and support it during D9 lifecycle. BTW in #3063887: Support PHPUnit 8 in Drupal 9, drop support for PHPUnit 7 we are likely going to drop PHPUnit 7 as well for D9.