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

Composer/GH Actions: allow for PHPUnit 11.x #196

Merged
merged 1 commit into from
Sep 6, 2024

Conversation

jrfnl
Copy link
Collaborator

@jrfnl jrfnl commented Sep 6, 2024

PHPUnit 11.0 has been released on Feb 2, 2024.

As the PHPUnit Polyfills, as of now, will officially support PHPUnit 11.x (with the exception of the TestListeners), the GH Actions workflow should be updated to reflect this.

This commit:

  • Allows for PHPUnit 11 in the composer.json require.
  • Add builds for PHP 8.2 and 8.3 against low PHPUnit 11 versions for the Composer based tests. The "high" versions are automatically sorted via the matrix auto setting in combination with the Composer PHPUnit version requirements being widened.
  • Add builds for PHP 8.2 and 8.3 against high/low PHPUnit 11 for the PHAR based tests.
  • Add an extra experimental build in both test workflows against PHP "nightly" to ensure both PHPUnit 9.x, 10.x, as well as PHPUnit 11.x are tested with PHP 8.4.
  • Updates the experimental build against "future" PHPUnit to always run against the latest official PHP release.

Regarding PHPUnit 11 and running code coverage:

Since PHPUnit 10, PHPUnit did not distinguish between PHPUnit and PHP deprecation notices anymore. This means that when failOnDeprecation is enabled (as is done for this library to be ready early for new PHP versions), a test run will also fail if there are PHPUnit native deprecation notices.

Now PHPUnit 11.2 deprecated the use of #[CoversClass] for traits and introduced a #[CoversTrait] attribute to replace this. However, it is currently impossible to action this deprecation notice in a PHPUnit cross-version compatible manner. This was reported upstream in sebastianbergmann/phpunit 5937

As a result of this report, PHPUnit, as of PHPUnit 10.5.32 and PHPUnit 11.3.3 will no longer exit with a non-zero exit code when failOnDeprecation is enabled and the only deprecations are PHPUnit native deprecations.

The net-effect of this is as follows:

  • Code coverage can run unrestricted on PHPUnit 10 for this test suite as there are no PHPUnit native deprecations which haven't been handled yet.
  • Code coverage can run on PHPUnit 11.0 - 11.1.x and on PHPUnit 11.3.3 and higher, but can not run on PHPUnit 11.2.0 - 11.3.2 as, due to the deprecation notices related to CoversClass for traits, the exit code would be non-zero.

Refs:

PHPUnit 11.0 has been released on Feb 2, 2024.

As the PHPUnit Polyfills, as of now, will officially support PHPUnit 11.x (with the exception of the TestListeners), the GH Actions workflow should be updated to reflect this.

This commit:
* Allows for PHPUnit 11 in the `composer.json` `require`.
* Add builds for PHP 8.2 and 8.3 against low PHPUnit 11 versions for the Composer based tests.
    The "high" versions are automatically sorted via the matrix `auto` setting in combination with the Composer PHPUnit version requirements being widened.
* Add builds for PHP 8.2 and 8.3 against high/low PHPUnit 11 for the PHAR based tests.
* Add an extra experimental build in both test workflows against PHP "nightly" to ensure both PHPUnit 9.x, 10.x, as well as PHPUnit 11.x are tested with PHP 8.4.
* Updates the experimental build against "future" PHPUnit to always run against the latest official PHP release.

**Regarding PHPUnit 11 and running code coverage**:

Since PHPUnit 10, PHPUnit did not distinguish between PHPUnit and PHP deprecation notices anymore.
This means that when `failOnDeprecation` is enabled (as is done for this library to be ready early for new PHP versions), a test run will also fail if there are PHPUnit native deprecation notices.

Now PHPUnit 11.2 deprecated the use of `#[CoversClass]` for traits and introduced a `#[CoversTrait]` attribute to replace this.
However, it is currently impossible to action this deprecation notice in a PHPUnit cross-version compatible manner.
This was reported upstream in sebastianbergmann/phpunit 5937

As a result of this report, PHPUnit, as of PHPUnit 10.5.32 and PHPUnit 11.3.3 will no longer exit with a non-zero exit code when `failOnDeprecation` is enabled and the only deprecations are PHPUnit native deprecations.

The net-effect of this is as follows:
* Code coverage can run unrestricted on PHPUnit 10 for this test suite as there are no PHPUnit native deprecations which haven't been handled yet.
* Code coverage can run on PHPUnit 11.0 - 11.1.x and on PHPUnit 11.3.3 and higher, but can not run on PHPUnit 11.2.0 - 11.3.2 as, due to the deprecation notices related to `CoversClass` for traits, the exit code would be non-zero.

Refs:
* https://phpunit.de/announcements/phpunit-11.html
* https://github.com/sebastianbergmann/phpunit/blob/11.0/ChangeLog-11.0.md
@jrfnl jrfnl added this to the 3.0.0 milestone Sep 6, 2024
@coveralls
Copy link

Coverage Status

coverage: 97.152%. remained the same
when pulling 9197a31 on feature/3.x/allow-for-phpunit-11
into e7fbd67 on 3.x.

Copy link
Collaborator

@hellofromtonya hellofromtonya left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@hellofromtonya hellofromtonya merged commit 62be834 into 3.x Sep 6, 2024
160 checks passed
@hellofromtonya hellofromtonya deleted the feature/3.x/allow-for-phpunit-11 branch September 6, 2024 20:07
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.

3 participants