Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependency yoast/phpunit-polyfills to v3 #40159

Closed
wants to merge 1 commit into from

Conversation

matticbot
Copy link
Contributor

@matticbot matticbot commented Nov 13, 2024

This PR contains the following updates:

Package Type Update Change
yoast/phpunit-polyfills require-dev major ^1.1.1 -> ^1.1.1 || ^3.0.0

Release Notes

Yoast/PHPUnit-Polyfills (yoast/phpunit-polyfills)

v3.0.0

Compare Source

PHPUnit 11 support

This release updates the PHPUnit Polyfills to allow for "writing your tests for PHPUnit 11 and running them all the way back to PHPUnit 6". [*]

Please keep in mind that the PHPUnit Polyfills provide forward-compatibility. This means that features which PHPUnit no longer supports in PHPUnit 11.x, are also no longer supported in the 3.0 release of the PHPUnit Polyfills.

Please refer to the PHPUnit 11 release notification and PHPUnit 11 changelog to inform your decision on whether or not to upgrade (yet).

Projects which don't use any of the new or removed functionality in their test suite, can, of course, use the PHPUnit Polyfills 1.x, 2.x and 3.x series side-by-side, like so composer require --dev yoast/phpunit-polyfills:"^1.0 || ^2.0 || ^3.0".

[*]: Note: Releases from the PHPUnit Polyfills 3.x branch will support running tests on PHPUnit 6.4.4 - 9.x and 11.x, but will not allow for running tests on PHPUnit 10 (for reasons explained in #​200).
In practical terms, the net effect of this is that tests on PHP 8.1 will run on PHPUnit 9 instead of PHPUnit 10. Other than that, there is no impact.

Changelog
Added
  • Yoast\PHPUnitPolyfills\Polyfills\AssertArrayWithListKeys trait to polyfill the Assert::assertArrayIsEqualToArrayOnlyConsideringListOfKeys(), Assert::assertArrayIsEqualToArrayIgnoringListOfKeys(), Assert::assertArrayIsIdenticalToArrayOnlyConsideringListOfKeys() and Assert::assertArrayIsIdenticalToArrayIgnoringListOfKeys() methods as introduced in PHPUnit 11.0.0. PR #​198.
  • Yoast\PHPUnitPolyfills\Polyfills\ExpectUserDeprecation trait to polyfill the TestCase::expectUserDeprecationMessage() and TestCase::expectUserDeprecationMessageMatches() methods as introduced in PHPUnit 11.0.0. PR #​200.
    These methods can largely be seen as replacements for the TestCase::expectDeprecationMessage() and TestCase::expectDeprecationMessageMatches() methods which were removed in PHPUnit 10.0, though there are significant differences between the implementation details of the old vs the new methods. Please see the README for full details.
  • Yoast\PHPUnitPolyfills\Polyfills\AssertObjectNotEquals trait to polyfill the Assert::assertObjectNotEquals() method as introduced in PHPUnit 11.2.0. PR #​199.
Changed
  • Composer: allow for installation of PHPUnit 11.x and removed runtime support for PHPUnit 10.x. PR #​196, #​200
  • The assertion failure message for the assertIsList() method has been updated to be in sync with the latest message format as used by PHPUnit 11.3.1+. #​195
  • The visibility of the expectExceptionMessageMatches() method has been changed from public to protected, in line with the same changes as per PHPUnit 11.0. #​197
  • The assertObjectEquals() method polyfill now behaves the same as the PHPUnit native assertion method. PR #​192
    Previously a comparator method could either be compatible with PHP 5.6+ in combination with PHPUnit < 9.4.0 or with PHP 7.0+, but it wasn't possible to write a comparator method which would work in both situation due to the return type declaration requirement from PHPUnit itself. With the new PHP 7.0 minimum requirement, the return type declaration is now always required and the polyfill and the PHPUnit native method are completely aligned.
  • General housekeeping.
Removed
  • Support for PHP < 7.0. PR #​192.
  • Support for PHPUnit < 6.4.4. PR #​193.
  • The Yoast\PHPUnitPolyfills\Helpers\AssertAttributeHelper trait. PR #​194.
    This "helper" was only intended as a temporary measure to buy people some more time to refactor their tests.
  • The Yoast\PHPUnitPolyfills\Polyfills\ExpectExceptionObject trait which is no longer needed now support for PHPUnit < 6.4 has been dropped. PR #​193.

v2.0.2

Compare Source

This is a maintenance release.

Changed
  • README: updated sub-section about PHPUnit version support with information about the PHPUnit Polyfills 3.x branch. PR [#​188]
  • README: FAQ updated with info about ability to polyfill the removed expectDeprecation*() methods et al. PR #​187, props [Tonya Mork].
  • README: links to the PHPUnit manual now point explicitly to the PHPUnit 10.x documentation. PR #​190
  • General housekeeping.

v2.0.1

Compare Source

Added
  • Compatibility fixes for running tests using a PHPUnit PHAR file for PHPUnit 8.5.38+, 9.6.19+ and PHPUnit 10.5.17+. PRs [#​161], #​164.
Changed
  • General housekeeping.

v2.0.0

Compare Source

PHPUnit 10 support

This release updates the PHPUnit Polyfills to allow for "writing your tests for PHPUnit 10 and running them all the way back to PHPUnit 5".

Please keep in mind that the PHPUnit Polyfills provide forward-compatibility. This means that features which PHPUnit no longer supports in PHPUnit 10.x, like expecting PHP deprecation notices or warnings, are also no longer supported in the 2.0 release of the PHPUnit Polyfills.

Please refer to the PHPUnit 10 release notification and PHPUnit 10 changelog to inform your decision on whether or not to upgrade (yet).

Projects which don't use any of the new or removed functionality in their test suite, can, of course, use the PHPUnit Polyfills 1.x and 2.x series side-by-side, like so composer require --dev yoast/phpunit-polyfills:"^1.0 || ^2.0".

⚠️ Important: about the TestListener polyfill ⚠️

The TestListener polyfill in PHPUnit Polyfills 2.0 is not (yet) compatible with PHPUnit 10.0.0.

If you need the TestListener polyfill, it is recommended to stay on the PHPUnit Polyfills 1.x series for the time being and to watch the related ticket.

Changelog
Added
  • Yoast\PHPUnitPolyfills\Polyfills\AssertIgnoringLineEndings trait to polyfill the Assert::assertStringEqualsStringIgnoringLineEndings() and the Assert::assertStringContainsStringIgnoringLineEndings() methods as introduced in PHPUnit 10.0.0. PR #​109.
  • Yoast\PHPUnitPolyfills\Polyfills\AssertIsList trait to polyfill the Assert::assertIsList() method as introduced in PHPUnit 10.0.0. PR #​110.
  • Yoast\PHPUnitPolyfills\Polyfills\AssertObjectProperty trait to polyfill the Assert::assertObjectHasProperty() and the Assert::assertObjectNotHasProperty() methods as introduced in PHPUnit 10.1.0. PR #​116.
Changed
  • Composer: allow for installation of PHPUnit 10.x. PR #​130
  • Nearly all assertion methods are now final. This alignes them with the same change made upstream in PHPUnit 10.0.0. PR #​104.
  • General housekeeping.
Removed
  • Support for PHP < 5.6. PR #​102.
  • Support for PHPUnit < 5.7.21. PR #​102.
  • Support for expecting PHP deprecations, notices, warnings and error via the Yoast\PHPUnitPolyfills\Polyfills\ExpectPHPException trait. PR #​108.
    The trait has been removed completely as PHPUnit 10 no longer supports this functionality.
  • The Yoast\PHPUnitPolyfills\Polyfills\AssertNumericType trait which is no longer needed now support for PHPUnit < 5.7 has been dropped. PR #​102.
  • The Yoast\PHPUnitPolyfills\Polyfills\ExpectException trait which is no longer needed now support for PHPUnit < 5.7 has been dropped. PR #​102.
  • The Yoast\PHPUnitPolyfills\Polyfills\AssertFileDirectory trait which is no longer needed now support for PHPUnit < 5.7 has been dropped. PR #​102.

Configuration

📅 Schedule: Branch creation - "* 0-2 1 * *" in timezone UTC, Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR has been generated by Renovate Bot.

@matticbot
Copy link
Contributor Author

matticbot commented Nov 13, 2024

⚠️ Artifact update problem

Renovate failed to update artifacts related to this branch. You probably do not want to merge this PR as-is.

♻ Renovate will retry this branch, including artifacts, only when one of the following happens:

  • any of the package files in this branch needs updating, or
  • the branch becomes conflicted, or
  • you click the rebase/retry checkbox if found above, or
  • you rename this PR's title to start with "rebase!" to trigger it manually

The artifact failure details are included below:

File name: projects/plugins/automattic-for-agencies-client/composer.lock
Command failed: composer update yoast/phpunit-polyfills:3.0.0 --with-dependencies --ignore-platform-req='ext-*' --ignore-platform-req='lib-*' --no-ansi --no-interaction
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires yoast/phpunit-polyfills ^1.1.1 || ^3.0.0, found yoast/phpunit-polyfills[dev-main, 1.1.1, 1.1.2, 1.x-dev, 3.0.0, 3.x-dev (alias of dev-main)] but these were not loaded, likely because it conflicts with another require.
  Problem 2
    - automattic/wordbless is locked to version 0.4.2 and an update of this package was not requested.
    - automattic/wordbless 0.4.2 requires yoast/phpunit-polyfills ^1.0 -> found yoast/phpunit-polyfills[1.0.0, ..., 1.x-dev] but it conflicts with your temporary update constraint (yoast/phpunit-polyfills:3.0.0).

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

File name: projects/plugins/boost/composer.lock
Command failed: composer update yoast/phpunit-polyfills:3.0.0 --with-dependencies --ignore-platform-req='ext-*' --ignore-platform-req='lib-*' --no-ansi --no-interaction
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires yoast/phpunit-polyfills ^1.1.1 || ^3.0.0, found yoast/phpunit-polyfills[dev-main, 1.1.1, 1.1.2, 1.x-dev, 3.0.0, 3.x-dev (alias of dev-main)] but these were not loaded, likely because it conflicts with another require.
  Problem 2
    - automattic/wordbless is locked to version 0.4.2 and an update of this package was not requested.
    - automattic/wordbless 0.4.2 requires yoast/phpunit-polyfills ^1.0 -> found yoast/phpunit-polyfills[1.0.0, ..., 1.x-dev] but it conflicts with your temporary update constraint (yoast/phpunit-polyfills:3.0.0).

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

File name: projects/plugins/classic-theme-helper-plugin/composer.lock
Command failed: composer update yoast/phpunit-polyfills:3.0.0 --with-dependencies --ignore-platform-req='ext-*' --ignore-platform-req='lib-*' --no-ansi --no-interaction
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires yoast/phpunit-polyfills ^1.1.1 || ^3.0.0, found yoast/phpunit-polyfills[dev-main, 1.1.1, 1.1.2, 1.x-dev, 3.0.0, 3.x-dev (alias of dev-main)] but these were not loaded, likely because it conflicts with another require.
  Problem 2
    - automattic/wordbless is locked to version 0.4.2 and an update of this package was not requested.
    - automattic/wordbless 0.4.2 requires yoast/phpunit-polyfills ^1.0 -> found yoast/phpunit-polyfills[1.0.0, ..., 1.x-dev] but it conflicts with your temporary update constraint (yoast/phpunit-polyfills:3.0.0).

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

File name: projects/plugins/protect/composer.lock
Command failed: composer update yoast/phpunit-polyfills:3.0.0 --with-dependencies --ignore-platform-req='ext-*' --ignore-platform-req='lib-*' --no-ansi --no-interaction
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires yoast/phpunit-polyfills ^1.1.1 || ^3.0.0, found yoast/phpunit-polyfills[dev-main, 1.1.1, 1.1.2, 1.x-dev, 3.0.0, 3.x-dev (alias of dev-main)] but these were not loaded, likely because it conflicts with another require.
  Problem 2
    - automattic/wordbless is locked to version 0.4.2 and an update of this package was not requested.
    - automattic/wordbless 0.4.2 requires yoast/phpunit-polyfills ^1.0 -> found yoast/phpunit-polyfills[1.0.0, ..., 1.x-dev] but it conflicts with your temporary update constraint (yoast/phpunit-polyfills:3.0.0).

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

File name: projects/plugins/social/composer.lock
Command failed: composer update yoast/phpunit-polyfills:3.0.0 --with-dependencies --ignore-platform-req='ext-*' --ignore-platform-req='lib-*' --no-ansi --no-interaction
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires yoast/phpunit-polyfills ^1.1.1 || ^3.0.0, found yoast/phpunit-polyfills[dev-main, 1.1.1, 1.1.2, 1.x-dev, 3.0.0, 3.x-dev (alias of dev-main)] but these were not loaded, likely because it conflicts with another require.
  Problem 2
    - automattic/wordbless is locked to version 0.4.2 and an update of this package was not requested.
    - automattic/wordbless 0.4.2 requires yoast/phpunit-polyfills ^1.0 -> found yoast/phpunit-polyfills[1.0.0, ..., 1.x-dev] but it conflicts with your temporary update constraint (yoast/phpunit-polyfills:3.0.0).

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

File name: projects/plugins/starter-plugin/composer.lock
Command failed: composer update yoast/phpunit-polyfills:3.0.0 --with-dependencies --ignore-platform-req='ext-*' --ignore-platform-req='lib-*' --no-ansi --no-interaction
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires yoast/phpunit-polyfills ^1.1.1 || ^3.0.0, found yoast/phpunit-polyfills[dev-main, 1.1.1, 1.1.2, 1.x-dev, 3.0.0, 3.x-dev (alias of dev-main)] but these were not loaded, likely because it conflicts with another require.
  Problem 2
    - automattic/wordbless is locked to version 0.4.2 and an update of this package was not requested.
    - automattic/wordbless 0.4.2 requires yoast/phpunit-polyfills ^1.0 -> found yoast/phpunit-polyfills[1.0.0, ..., 1.x-dev] but it conflicts with your temporary update constraint (yoast/phpunit-polyfills:3.0.0).

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

File name: projects/plugins/videopress/composer.lock
Command failed: composer update yoast/phpunit-polyfills:3.0.0 --with-dependencies --ignore-platform-req='ext-*' --ignore-platform-req='lib-*' --no-ansi --no-interaction
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires yoast/phpunit-polyfills ^1.1.1 || ^3.0.0, found yoast/phpunit-polyfills[dev-main, 1.1.1, 1.1.2, 1.x-dev, 3.0.0, 3.x-dev (alias of dev-main)] but these were not loaded, likely because it conflicts with another require.
  Problem 2
    - automattic/wordbless is locked to version 0.4.2 and an update of this package was not requested.
    - automattic/wordbless 0.4.2 requires yoast/phpunit-polyfills ^1.0 -> found yoast/phpunit-polyfills[1.0.0, ..., 1.x-dev] but it conflicts with your temporary update constraint (yoast/phpunit-polyfills:3.0.0).

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

File name: projects/plugins/wpcomsh/composer.lock
Command failed: composer update yoast/phpunit-polyfills:3.0.0 --with-dependencies --ignore-platform-req='ext-*' --ignore-platform-req='lib-*' --no-ansi --no-interaction
Loading composer repositories with package information
������������������������������������������������������                                                      ������������������������������������������������������Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires yoast/phpunit-polyfills ^1.1.1 || ^3.0.0, found yoast/phpunit-polyfills[dev-main, 1.1.1, 1.1.2, 1.x-dev, 3.0.0, 3.x-dev (alias of dev-main)] but these were not loaded, likely because it conflicts with another require.
  Problem 2
    - automattic/wordbless is locked to version 0.4.2 and an update of this package was not requested.
    - automattic/wordbless 0.4.2 requires yoast/phpunit-polyfills ^1.0 -> found yoast/phpunit-polyfills[1.0.0, ..., 1.x-dev] but it conflicts with your temporary update constraint (yoast/phpunit-polyfills:3.0.0).

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

@matticbot matticbot added [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. [Type] Janitorial labels Nov 13, 2024
Copy link
Contributor

github-actions bot commented Nov 13, 2024

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WordPress.com Simple site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin, and enable the renovate/yoast-phpunit-polyfills-3.x branch.

    • For jetpack-mu-wpcom changes, also add define( 'JETPACK_MU_WPCOM_LOAD_VIA_BETA_PLUGIN', true ); to your wp-config.php file.
  • To test on Simple, run the following command on your sandbox:

    bin/jetpack-downloader test jetpack renovate/yoast-phpunit-polyfills-3.x
    
    bin/jetpack-downloader test jetpack-mu-wpcom-plugin renovate/yoast-phpunit-polyfills-3.x
    

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@matticbot matticbot force-pushed the renovate/yoast-phpunit-polyfills-3.x branch from db713ec to 7e45310 Compare November 13, 2024 18:13
@matticbot matticbot force-pushed the renovate/yoast-phpunit-polyfills-3.x branch from 7e45310 to 6999248 Compare December 1, 2024 00:43
@matticbot matticbot force-pushed the renovate/yoast-phpunit-polyfills-3.x branch from 6999248 to 0b97ecd Compare December 12, 2024 16:12
@robertsreberski robertsreberski requested a review from a team December 20, 2024 13:41
@tbradsha
Copy link
Contributor

Closing for now; this is a larger change that will need to be addressed manually.

@tbradsha tbradsha closed this Dec 20, 2024
@anomiex anomiex deleted the renovate/yoast-phpunit-polyfills-3.x branch December 20, 2024 13:55
@github-actions github-actions bot removed the [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. label Dec 20, 2024
@robertsreberski
Copy link
Contributor

Thanks for the explanation, I will note it down!

@matticbot
Copy link
Contributor Author

Renovate Ignore Notification

Because you closed this PR without merging, Renovate will ignore this update. You will not get PRs for any future 3.x releases. But if you manually upgrade to 3.x then Renovate will re-enable minor and patch updates automatically.

If you accidentally closed this PR, or if you changed your mind: rename this PR to get a fresh replacement PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants