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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mondrake created an issue. See original summary.

mondrake’s picture

mondrake’s picture

mondrake’s picture

Title: [PP-1] Drop support of PHPUnit 6 in Drupal 9 » Drop support of PHPUnit 6 in Drupal 9
Status: Postponed » Needs work

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

mondrake’s picture

longwave’s picture

Status: Needs work » Needs review
FileSize
60.72 KB
$ COMPOSER_ROOT_VERSION=9.0.x-dev composer update phpunit/phpunit phpspec/prophecy --with-dependencies
...
$ composer-lock-diff --no-links
+-----------------------------------+--------+---------+
| Dev Changes                       | From   | To      |
+-----------------------------------+--------+---------+
| myclabs/deep-copy                 | 1.7.0  | 1.9.5   |
| phar-io/manifest                  | 1.0.1  | 1.0.3   |
| phar-io/version                   | 1.0.1  | 2.0.1   |
| phpdocumentor/reflection-common   | 1.0.1  | 2.0.0   |
| phpdocumentor/reflection-docblock | 4.3.2  | 4.3.4   |
| phpdocumentor/type-resolver       | 0.5.1  | 1.0.1   |
| phpspec/prophecy                  | 1.9.0  | v1.10.2 |
| phpunit/php-code-coverage         | 5.3.2  | 6.1.4   |
| phpunit/php-file-iterator         | 1.4.5  | 2.0.2   |
| phpunit/php-timer                 | 1.0.9  | 2.1.2   |
| phpunit/php-token-stream          | 2.0.2  | 3.1.1   |
| phpunit/phpunit                   | 6.5.14 | 7.5.20  |
| phpunit/phpunit-mock-objects      | 5.0.10 | REMOVED |
| sebastian/comparator              | 2.1.3  | 3.0.2   |
| sebastian/diff                    | 2.0.1  | 3.0.2   |
| sebastian/environment             | 3.1.0  | 4.2.3   |
| sebastian/resource-operations     | 1.0.0  | 2.0.1   |
| webmozart/assert                  | 1.5.0  | 1.6.0   |
+-----------------------------------+--------+---------+
mondrake’s picture

Note: 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.

mondrake’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll
longwave’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
53.82 KB

Rebased against 9.0.x.

longwave’s picture

DamienMcKenna’s picture

Tagging as a requirement for Drupal 9.0-beta1.

Gábor Hojtsy’s picture

Title: Drop support of PHPUnit 6 in Drupal 9 » Drop support of PHPUnit 6 in Drupal 9 because it will never get used anyway

What 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 :)

Gábor Hojtsy’s picture

There 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 :)

longwave’s picture

Issue summary: View changes

Updated 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 :)

Gábor Hojtsy’s picture

Makes sense. We can do this first :) What is still left here other than reviews?

mondrake’s picture

Maybe 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?

Gábor Hojtsy’s picture

xjm’s picture

Shouldn't we be going to PHPUnit 8?

longwave’s picture

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

Gábor Hojtsy’s picture

mondrake’s picture

#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 -

PHPUnit 8 support in D9 would be basically only one blocker ... away

and BTW, much, much simpler...

alexpott’s picture

Status: Needs review » Fixed
Issue tags: -Needs framework manager review +9.0.0 release notes

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

  • alexpott committed 53b4bf9 on 9.0.x
    Issue #3106918 by longwave, mondrake, Gábor Hojtsy: Drop support of...
jibran’s picture

Should we have not removed

        "drupal-phpunit-upgrade-check": "Drupal\\Core\\Composer\\Composer::upgradePHPUnit",
        "drupal-phpunit-upgrade": "@composer update phpunit/phpunit symfony/phpunit-bridge phpspec/prophecy symfony/yaml --with-dependencies --no-progress",

as well?

mondrake’s picture

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

Status: Fixed » Closed (fixed)

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