Skip to content

Commit 065d1b2

Browse files
committed
Changelog for the 3.0.0 release and other documentation updates
Includes for the README: * Updating the badge links * Updating the warning about the TestListener polyfill not (yet) being compatible with PHPUnit 10/11. * Removing the FAQ entry about `expectDeprecation*()` et al. Includes updating the `VERSION` constant in the `Autoload` class. Includes minor release checklist update.
1 parent a053b9d commit 065d1b2

File tree

4 files changed

+75
-10
lines changed

4 files changed

+75
-10
lines changed

.github/RELEASE-CHECKLIST.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ If releases for multiple branches are to be tagged, always tag the 1.x release f
1515
Verify that a release link at the bottom of the `CHANGELOG.md` file has been added.
1616
- [ ] Merge the changelog PR.
1717
- [ ] Make sure all CI builds are green.
18-
- [ ] Tag the release on the 2.x branch (careful, GH defaults to `3.x`!).
18+
- [ ] Fast-forward the `main` branch to the latest `3.x` commit and push.
19+
- [ ] Tag the release on `main` (careful, GH defaults to `3.x`!).
1920
- [ ] Create a release from the tag (careful, GH defaults to `3.x`!) & copy & paste the changelog to it.
2021
Make sure to copy the links to the issues and the links to the GH usernames from the bottom of the changelog!
2122
- [ ] Close the milestone.

CHANGELOG.md

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,61 @@ This projects adheres to [Keep a CHANGELOG](http://keepachangelog.com/) and uses
99

1010
_Nothing yet._
1111

12+
## [3.0.0] - 2024-09-07
13+
14+
### PHPUnit 11 support
15+
16+
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"_. \[*\]
17+
18+
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.
19+
20+
Please refer to the [PHPUnit 11 release notification] and [PHPUnit 11 changelog] to inform your decision on whether or not to upgrade (yet).
21+
22+
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"`.
23+
24+
[PHPUnit 11 release notification]: https://phpunit.de/announcements/phpunit-11.html
25+
[PHPUnit 11 changelog]: https://github.com/sebastianbergmann/phpunit/blob/11.0.10/ChangeLog-11.0.md
26+
27+
\[*\]: _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])._
28+
_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._
29+
30+
31+
### Changelog
32+
33+
#### Added
34+
* `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].
35+
* `Yoast\PHPUnitPolyfills\Polyfills\ExpectUserDeprecation` trait to polyfill the `TestCase::expectUserDeprecationMessage()` and `TestCase::expectUserDeprecationMessageMatches()` methods as introduced in PHPUnit 11.0.0. PR [#200].
36+
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][readme-on-expectuserdeprecation].
37+
* `Yoast\PHPUnitPolyfills\Polyfills\AssertObjectNotEquals` trait to polyfill the `Assert::assertObjectNotEquals()` method as introduced in PHPUnit 11.2.0. PR [#199].
38+
39+
#### Changed
40+
* Composer: allow for installation of PHPUnit 11.x and removed runtime support for PHPUnit 10.x. PR [#196], [#200]
41+
* 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]
42+
* 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]
43+
* The `assertObjectEquals()` method polyfill now behaves the same as the PHPUnit native assertion method. PR [#192]
44+
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.
45+
* General housekeeping.
46+
47+
#### Removed
48+
* Support for PHP < 7.0. PR [#192].
49+
* Support for PHPUnit < 6.4.4. PR [#193].
50+
* The `Yoast\PHPUnitPolyfills\Helpers\AssertAttributeHelper` trait. PR [#194].
51+
This "helper" was only intended as a temporary measure to buy people some more time to refactor their tests.
52+
* The `Yoast\PHPUnitPolyfills\Polyfills\ExpectExceptionObject` trait which is no longer needed now support for PHPUnit < 6.4 has been dropped. PR [#193].
53+
54+
[#192]: https://github.com/Yoast/PHPUnit-Polyfills/pull/192
55+
[#193]: https://github.com/Yoast/PHPUnit-Polyfills/pull/193
56+
[#194]: https://github.com/Yoast/PHPUnit-Polyfills/pull/194
57+
[#195]: https://github.com/Yoast/PHPUnit-Polyfills/pull/195
58+
[#196]: https://github.com/Yoast/PHPUnit-Polyfills/pull/196
59+
[#197]: https://github.com/Yoast/PHPUnit-Polyfills/pull/197
60+
[#198]: https://github.com/Yoast/PHPUnit-Polyfills/pull/198
61+
[#199]: https://github.com/Yoast/PHPUnit-Polyfills/pull/199
62+
[#200]: https://github.com/Yoast/PHPUnit-Polyfills/pull/200
63+
64+
[readme-on-expectuserdeprecation]: https://github.com/Yoast/PHPUnit-Polyfills/tree/3.x?tab=readme-ov-file#phpunit--1100-yoastphpunitpolyfillspolyfillsexpectuserdeprecation
65+
66+
1267
## [2.0.2] - 2024-09-07
1368

1469
This is a maintenance release.
@@ -268,7 +323,8 @@ As of version 2.15.0 of the `shivammathur/setup-php` action for GitHub Actions,
268323
Initial release.
269324

270325

271-
[Unreleased]: https://github.com/Yoast/PHPUnit-Polyfills/compare/2.x...HEAD
326+
[Unreleased]: https://github.com/Yoast/PHPUnit-Polyfills/compare/3.x...HEAD
327+
[3.0.0]: https://github.com/Yoast/PHPUnit-Polyfills/compare/2.0.2...3.0.0
272328
[2.0.2]: https://github.com/Yoast/PHPUnit-Polyfills/compare/2.0.1...2.0.2
273329
[2.0.1]: https://github.com/Yoast/PHPUnit-Polyfills/compare/2.0.0...2.0.1
274330
[2.0.0]: https://github.com/Yoast/PHPUnit-Polyfills/compare/1.1.2...2.0.0

README.md

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ PHPUnit Polyfills
55
[![CS Build Status](https://github.com/Yoast/PHPUnit-Polyfills/actions/workflows/cs.yml/badge.svg)](https://github.com/Yoast/PHPUnit-Polyfills/actions/workflows/cs.yml)
66
[![Lint Build Status](https://github.com/Yoast/PHPUnit-Polyfills/actions/workflows/lint.yml/badge.svg)](https://github.com/Yoast/PHPUnit-Polyfills/actions/workflows/lint.yml)
77
[![Test Build Status](https://github.com/Yoast/PHPUnit-Polyfills/actions/workflows/test.yml/badge.svg)](https://github.com/Yoast/PHPUnit-Polyfills/actions/workflows/test.yml)
8-
[![Coverage Status](https://coveralls.io/repos/github/Yoast/PHPUnit-Polyfills/badge.svg?branch=2.x)](https://coveralls.io/github/Yoast/PHPUnit-Polyfills?branch=2.x)
8+
[![Coverage Status](https://coveralls.io/repos/github/Yoast/PHPUnit-Polyfills/badge.svg?branch=3.x)](https://coveralls.io/github/Yoast/PHPUnit-Polyfills?branch=3.x)
99

1010
[![Minimum PHP Version](https://img.shields.io/packagist/php-v/yoast/phpunit-polyfills.svg?maxAge=3600)](https://packagist.org/packages/yoast/phpunit-polyfills)
1111
[![License: BSD3](https://poser.pugx.org/yoast/phpunit-polyfills/license)](https://github.com/Yoast/PHPUnit-Polyfills/blob/main/LICENSE)
@@ -34,7 +34,7 @@ Requirements
3434
------------
3535

3636
* PHP 7.0 or higher.
37-
* [PHPUnit] 6.4 - 10.x (automatically required via Composer).
37+
* [PHPUnit] 6.4 - 9.x and 11.x (automatically required via Composer).
3838

3939
[PHPUnit]: https://packagist.org/packages/phpunit/phpunit
4040

@@ -44,7 +44,7 @@ Installation
4444

4545
To install this package, run:
4646
```bash
47-
composer require --dev yoast/phpunit-polyfills:"^2.0"
47+
composer require --dev yoast/phpunit-polyfills:"^3.0"
4848
```
4949

5050
To update this package, run:
@@ -64,7 +64,7 @@ Why use the PHPUnit Polyfills?
6464

6565
This library is set up to allow for creating PHPUnit cross-version compatible tests by offering a number of polyfills for functionality which was introduced, split up or renamed in PHPUnit.
6666

67-
### Write your tests for PHPUnit 10.x and run them on PHPUnit 6.4 - 10.x
67+
### Write your tests for PHPUnit 11.x and run them on PHPUnit 6.4 - 11.x
6868

6969
The polyfills have been setup to allow tests to be _forward_-compatible. What that means is, that your tests can use the assertions supported by the _latest_ PHPUnit version, even when running on older PHPUnit versions.
7070

@@ -605,7 +605,7 @@ class MyTest extends XTestCase {
605605

606606
> :warning: **Important** :warning:
607607
>
608-
> The TestListener polyfill in PHPUnit Polyfills 2.0 is [not (yet) compatible with PHPUnit 10.0.0][polyfill-ticket].
608+
> The TestListener polyfill in PHPUnit Polyfills 2.0/3.0 is [not (yet) compatible with PHPUnit 10.x/11.x][polyfill-ticket].
609609
>
610610
> 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 and upvote the [related ticket][polyfill-ticket].
611611
>
@@ -682,10 +682,8 @@ For frequently used, removed PHPUnit functionality, "helpers" may be provided. T
682682
| PHPUnit | Removed | Issue | Remarks |
683683
| ------- | --------------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
684684
| 9.0.0 | `assertArraySubset()` | [#1][issue #1] | The [`dms/phpunit-arraysubset-asserts`](https://packagist.org/packages/dms/phpunit-arraysubset-asserts) package polyfills this functionality.<br/>As of [version 0.3.0](https://github.com/rdohms/phpunit-arraysubset-asserts/releases/tag/v0.3.0) this package can be installed in combination with PHP 5.4 - current and PHPUnit 4.8.36/5.7.21 - current.<br/>Alternatively, tests can be refactored using the patterns outlined in [issue #1]. |
685-
| 10.0.0 | `expectDeprecation*()` et al | [#186][issue #186] | A [custom polyfill approach tutorial](https://github.com/Yoast/PHPUnit-Polyfills/issues/186#issuecomment-2334326687) is available. Alternatively, tests can be refactored to skip running the `expectDeprecation*()` et al or skip the test completely on PHPUnit 10, while still running them on <= PHPUnit 9. |
686685

687686
[issue #1]: https://github.com/Yoast/PHPUnit-Polyfills/issues/1
688-
[issue #186]: https://github.com/Yoast/PHPUnit-Polyfills/issues/186
689687

690688
### Q: Can this library be used when the tests are being run via a PHPUnit Phar file ?
691689

@@ -754,6 +752,16 @@ if ( defined( '\Yoast\PHPUnitPolyfills\Autoload::VERSION' ) === false
754752
}
755753
```
756754

755+
### Q: Why don't the PHPUnit Polyfills 3.x versions support running tests on PHPUnit 10 ?
756+
757+
PHPUnit 11.0 introduced the `expectUserDeprecationMessage*()` methods. To polyfill these for PHPUnit 10 would mean that the Polyfills package could no longer be a "drop-in" helper package, but would need to set extra requirements on test suites using the polyfills when used with PHPUnit 10 (like hooking into events or compulsory use of the `TestCase`s provided by this package).
758+
759+
As it was deemed desirable enough to polyfill the methods, the releases from the 3.x branch of the PHPUnit Polyfills do not support running tests on PHPUnit 10.
760+
761+
The impact of this compromise is minimal, as, in the most common case of running the tests with Composer installed dependencies, this just and only means that test runs on PHP 8.1 will use PHPUnit 9 instead of PHPUnit 10. There is no other impact.
762+
763+
Keep in mind that functionality _added_ in PHPUnit 10, is still polyfilled and available in PHPUnit Polyfills 3.x.
764+
757765

758766
Contributing
759767
------------

phpunitpolyfills-autoload.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ final class Autoload {
1818
*
1919
* @var string
2020
*/
21-
const VERSION = '3.0.0-dev';
21+
const VERSION = '3.0.0';
2222

2323
/**
2424
* Loads a class.

0 commit comments

Comments
 (0)