You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[ ] Confirm that the most recent PHPUnit changelogs have been checked and that the library is still feature complete for those versions supported within the PHPUnit version constraints.
8
+
-[ ] Update the `VERSION` constant in the `phpunitpolyfills-autoload.php` file.
9
+
-[ ] Composer: check if any dependencies/version constraints need updating.
10
+
11
+
### Release:
12
+
-[ ] Add changelog for the release - PR #xxx
13
+
Verify that a release link at the bottom of the `CHANGELOG.md` file has been added.
14
+
-[ ] Merge this PR.
15
+
-[ ] Make sure all CI builds are green.
16
+
-[ ] Tag the release (careful, GH defaults to `develop`!).
17
+
-[ ] Create a release from the tag (careful, GH defaults to `develop`!) & copy & paste the changelog to it.
18
+
Make sure to copy the links to the issues and the links to the GH usernames from the bottom of the changelog!
19
+
-[ ] Close the milestone.
20
+
-[ ] Open a new milestone for the next release.
21
+
-[ ] If any open PRs/issues which were milestoned for the release did not make it into the release, update their milestone.
22
+
23
+
### Announce:
24
+
-[ ] Tweet about the release.
25
+
26
+
27
+
---
28
+
29
+
Additional actions to take, not part of the release checklist:
30
+
-[ ] Post a link to the release in the Yoast Slack.
31
+
-[ ] Update the dependency version constraints for WP Test Utils.
Copy file name to clipboardExpand all lines: CHANGELOG.md
+17-1Lines changed: 17 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,13 +9,27 @@ This projects adheres to [Keep a CHANGELOG](http://keepachangelog.com/) and uses
9
9
10
10
_Nothing yet._
11
11
12
+
## [1.0.1] - 2021-08-09
13
+
14
+
### Added
15
+
* The `Yoast\PHPUnitPolyfills\Autoload` class now contains a `VERSION` constant. Issue [#46], PR [#47], props [Pascal Birchler] for the suggestion.
16
+
This version constant can be used by (complex) test setups to verify that the PHPUnit Polyfills which will be loaded, comply with the version requirements for the test suite.
*`Yoast\PHPUnitPolyfills\Polyfills\AssertClosedResource` trait to polyfill the `Assert::assertIsClosedResource()` and `Assert::assertIsNotClosedResource()` methods as introduced in PHPUnit 9.3.0. PR [#27].
16
30
*`Yoast\PHPUnitPolyfills\Polyfills\AssertObjectEquals` trait to polyfill the `Assert::assertObjectEquals()` method as introduced in PHPUnit 9.4.0. PR [#38].
17
31
The behaviour of the polyfill closely matches the PHPUnit native implementation, but is not 100% the same.
18
-
Most notably, the polyfill will check the type of the returned value from the comparator method instead of the enforcing a return type declaration of the comparator method.
32
+
Most notably, the polyfill will check the type of the returned value from the comparator method instead of enforcing a return type declaration for the comparator method.
19
33
*`Yoast\PHPUnitPolyfills\Polyfills\EqualToSpecializations` trait to polyfill the `Assert::equalToCanonicalizing()`, `Assert::equalToIgnoringCase()` and `Assert::equalToWithDelta()` methods as introduced in PHPUnit 9.0.0. PR [#28], props [Marc Siegrist].
20
34
* Polyfills for the PHP native `Error` and `TypeError` classes as introduced in PHP 7.0. PR [#36].
21
35
* README: FAQ section covering functionality removed from PHPUnit and usage with a Phar.
Copy file name to clipboardExpand all lines: README.md
+32-7Lines changed: 32 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -128,7 +128,7 @@ For the polyfills to work, a test class is **required** to be a (grand-)child of
128
128
129
129
If your library still needs to support PHP < 5.6 and therefore needs PHPUnit 4 for testing, there are a few caveats when using the traits stand-alone as we then enter "double-polyfill" territory.
130
130
131
-
To prevent "conflicting method names" errors when a trait is `use`d multiple times in a class, the traits offered here do not attempt to solve this.
131
+
To prevent _"conflicting method names"_ errors when a trait is `use`d multiple times in a class, the traits offered here do not attempt to solve this.
132
132
133
133
You will need to make sure to `use` any additional traits needed for the polyfills to work.
Polyfills the [`Assert::assertObjectEquals()`] method to verify two (value) objects are considered equal.
442
442
This assertion expects an object to contain a comparator method in the object itself. This comparator method is subsequently called to verify the "equalness" of the objects.
443
443
444
-
The `assertObjectEquals() assertion was introduced in PHPUnit 9.4.0.
444
+
The `assertObjectEquals()` assertion was introduced in PHPUnit 9.4.0.
445
445
446
-
> :info: Due to [limitations in how this assertion is implemented in PHPUnit] itself, it is currently not possible to create a single comparator method which will be compatible with both PHP < 7.0 and PHP 7.0 or higher.
446
+
> :information_source: Due to [limitations in how this assertion is implemented in PHPUnit] itself, it is currently not possible to create a single comparator method which will be compatible with both PHP < 7.0 and PHP 7.0 or higher.
447
447
>
448
448
> In effect two declarations of the same object would be needed to be compatible with PHP < 7.0 and PHP 7.0 and higher and still allow for testing the object using the `assertObjectEquals()` assertion.
449
449
>
450
450
> Due to this limitation, it is recommended to only use this assertion if the minimum supported PHP version of a project is PHP 7.0 or higher; or if the project does not run its tests on PHPUnit >= 9.4.0.
451
+
>
452
+
> The implementation of this assertion in the Polyfills is PHP cross-version compatible.
451
453
452
454
[limitations in how this assertion is implemented in PHPUnit]: https://github.com/sebastianbergmann/phpunit/issues/4707
453
455
454
-
<!--
455
-
COMMENT: No documentation available (yet) for this assertion on the PHPUnit site.
@@ -687,6 +688,30 @@ Yes, this package can also be used when running tests via a PHPUnit Phar file.
687
688
In that case, make sure that the `phpunitpolyfills-autoload.php` file is explicitly `require`d in the test bootstrap file.
688
689
(Not necessary when the Composer `vendor/autoload.php` file is used as, or `require`d in, the test bootstrap.)
689
690
691
+
### Q: How can I verify the version used of the PHPUnit Polyfills library ?
692
+
693
+
For complex test setups, like when the Polyfills are provided via a test suite dependency, or may already be loaded via an overarching project, it can be useful to be able to check that a version of the package is used which complies with the requirements for your test suite.
694
+
695
+
As of version 1.0.1, the PHPUnit Polyfills `Autoload` class contains a version number which can be used for this purpose.
696
+
697
+
Typically such a check would be done in the test suite bootstrap file and could look something like this:
698
+
```php
699
+
$versionRequirement = '1.0.1';
700
+
if ( class_exists( '\Yoast\PHPUnitPolyfills\Autoload' ) === false ) {
0 commit comments