-
Notifications
You must be signed in to change notification settings - Fork 498
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
Replace PHPUnit 6+ compat code with Yoast PHPUnit polyfills package #446
Conversation
While I fully support this change, I hadn't done so myself previously as it will prohibit the tests from being run on PHP < 5.5 (PHPUnit Polyfills has a minimum supported PHP version of PHP 5.5), while I'm totally behind dropping support for PHP < 5.6, but I think we should do that in a major, not a patch version. With that in mind, shall we milestone this PR for 2.0.0 ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Alain, notwithstanding my other remark, I've gone through the PR anyhow to verify it.
Aside from some small remarks I've left in-line:
- Missing: the
RequestsTest_TestCase
class.
All tests now extend from it, but the file itself is not included in this PR, so the tests can't be run at the moment.
I'm presuming that that file extends theTestCase
from PHPUnit Polyfills to actually make the polyfills available ? - Missing: the PHPUnit cache file which is generated when using PHPUnit 8/9 should be added to the
.gitignore
file.
Other than that and not for this PR, but just as a reminder for later:
- The
RequestsTests_Encoding::bin2hex()
looks like it isn't used ? - When PHP < 5.5 is officially dropped, I'd recommend namespacing the tests according to PSR4, removing the custom
autoload_tests()
function from the test bootstrap and adding anautoload-dev
section to thecomposer.json
file to handle the autoloading.
(would also be nice for the main library, but would be a big breaking change, so that needs a different consideration)
f8bce92
to
0351570
Compare
Where did that one go? Seems like I forgot to add it to the commits, because I'm pretty sure this never worked without it. :) |
It was in the branch which extended off this one with the initial GH Actions setup. (and why that branch wasn't deleted yet) |
Co-authored-by: Juliette <[email protected]>
Co-authored-by: Juliette <[email protected]>
Co-authored-by: Juliette <[email protected]>
349332c
to
3953026
Compare
I've added one significant (and one insignificant) commit which fixes a problem when running the tests against a PHPUnit phar file. If the ( The errors are:
Note: when the All the same, by reversing commit 07b71f0 and adding a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All good now!
@schlessera I'll leave this open for the moment to give you a chance to review the additional commits I added and to test this version locally.
Happy for it to be merged though.
PHPUnit Polyfills 1.0.0 have been released. Ref: https://github.com/Yoast/PHPUnit-Polyfills/releases/tag/1.0.0
This PR replaces the few pieces of PHPUnit 6+ compact code with a more strategic polyfill library (https://github.com/Yoast/PHPUnit-Polyfills).
The PR also includes changes to adapt the tests to use PHPUnit 9+ syntax as needed, which is then polyfilled down to lower PHPUnit versions.