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

Support testing against PHP 8 and 8.1. #1209

Merged
merged 8 commits into from
Dec 1, 2021
Merged

Conversation

dcr-stripe
Copy link
Contributor

@dcr-stripe dcr-stripe commented Nov 29, 2021

Summary

This PR:

  • Runs CI for PHP 8.0 and PHP 8.1.
  • Changes composer.json to require (as a devDependency) EITHER phpunit 5.7, which is compatible with PHP <=7.2; OR phpunit 9.0, which is compatible with PHP 8.
    • Some functions in phpunit 9.0 don't exist in phpunit 5.7. To keep our test suite compatible with both, we extend the PHPUnit TestCase class and add some "shims" over top of them.
  • Fixes the flaky StripeTelemetryTest
  • Updates the php-cs-fixer task to run on PHP8
    • Towards that end, upgrade php-cs-fixer to the recent version 3.2.1 (|| 2.17.1 is provided as a fallback so composer install doesn't break on old versions of PHP)
    • Make small formatting/style changes associated with that upgrade.

fixes #1200 #1199

@richardm-stripe
Copy link
Contributor

@dcr-stripe will you take a look at this?

Copy link
Contributor Author

@dcr-stripe dcr-stripe left a comment

Choose a reason for hiding this comment

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

This looks good to me overall! Thanks for all your hard work on this Richard! 🎉

(I can't approve since it's my own PR)

fail-fast: false
matrix:
php-version:
- "7.4"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should we run this on 8.1 as well?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I have that in a forthcoming PR. There are some warnings I need to address first.

"php-coveralls/php-coveralls": "^2.1",
"squizlabs/php_codesniffer": "^3.3",
"symfony/process": "~3.4",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Confirming this was just a stale require?

Copy link
Contributor

@richardm-stripe richardm-stripe Dec 1, 2021

Choose a reason for hiding this comment

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

Good call. I assumed this too, but I was wrong. We actually use it in StripeMock.php which apparently attempts to boot up stripe-mock if you aren't already running it?

In our CI we always boot up stripe-mock in a separate step, and I always boot stripe-mock up manually, so I went ahead and removed this file, and now the devDependency is unused.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

LGTM - good find!

@dcr-stripe dcr-stripe changed the title [wip] Dcr/php 8 tests Support testing against PHP 8 and 8.1. Nov 30, 2021
@richardm-stripe richardm-stripe merged commit a6be5eb into master Dec 1, 2021
@richardm-stripe richardm-stripe deleted the dcr/php-8-tests branch December 1, 2021 16:48
@hivokas
Copy link

hivokas commented Dec 2, 2021

This is awesome, thanks for your work!

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

Successfully merging this pull request may close these issues.

3 participants