Skip to content

PHPUnit: Let PHPUnit Polyfills match PHPUnit version - #43334

Merged
hellofromtonya merged 1 commit into
trunkfrom
try/use-phpunit-polyfills
Aug 18, 2022
Merged

hellofromtonya merged 1 commit into
trunkfrom
try/use-phpunit-polyfills

Conversation

@hellofromtonya

@hellofromtonya hellofromtonya commented Aug 17, 2022 •

Copy link
Copy Markdown
Contributor

Part of #43333

What?

Lets PHPUnit Polyfills match the PHPUnit version to the PHP version.

Before this PR, the Gutenberg tests run on PHP 7.4 and use PHPUnit 6.5. However, the matching PHPUnit version should be PHPUnit 9.

PHPUnit 6.5.14 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.4.[30](https://github.com/WordPress/gutenberg/runs/7878291592?check_suite_focus=true#step:7:31)
Configuration: /var/www/html/wp-content/plugins/gutenberg/phpunit.xml.dist

This PR uses PHPUnit Polyfills to set the PHPUnit version, rather than setting the version in the composer.json file and locking it in the .lock file.

Why?

Reasons:

  • To match the PHP and PHPUnit versions.
  • To increase parity with WordPress Core's PHP tests.
  • To unlock the ability to run Gutenberg PHP tests against all WordPress Core supported PHP versions (for cross-compatibility and parity with Core).
  • To reduce backporting efforts.
  • PHPUnit 6.5 is not meant for PHP 7.4. There are issues and incompatibilities when running it on PHP 7.4.

How?

See the set up instructions in this Dev Note.

The changes are:

  • Remove the Composer dependency from composer.json.
  • Remove the composer.lock file. Why? To allow for cross-version PHP testing.
  • Exclude committing composer.lock file. Why? One .lock file locks the CI into only those versions specified in that .lock file, thus blocking the ability to do cross-version PHP testing.

CI updates to run cross-version PHP testing is not included in the scope of this PR. A future PR will be coming. Note: WordPress Core runs the PHP test suite on all of the supported versions.

@hellofromtonya hellofromtonya added the [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. label Aug 17, 2022
@hellofromtonya hellofromtonya self-assigned this Aug 17, 2022

@ockham ockham left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @hellofromtonya! LGTM :shipit:

@hellofromtonya
hellofromtonya merged commit 20d80ef into trunk Aug 18, 2022
@hellofromtonya
hellofromtonya deleted the try/use-phpunit-polyfills branch August 18, 2022 10:52
@github-actions github-actions Bot added this to the Gutenberg 14.0 milestone Aug 18, 2022
hellofromtonya pushed a commit that referenced this pull request Aug 18, 2022
Removes and gitignore composer.lock file
Removes PHPUnit dep from composer.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants