-
Notifications
You must be signed in to change notification settings - Fork 207
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
PHP 8.1 compatibility fixes #3357
PHP 8.1 compatibility fixes #3357
Conversation
…ps://github.com/woocommerce/woocommerce-gateway-stripe into fix/compatibility-with-php-8-1-and-phpunit-10-5
…ility-with-php-8-1-and-phpunit-10-5
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.
Thanks for working on the newer PHP fixes @wjrosa!
The code changes look good, and all tests pass*. I left a few comments with questions.
- The E2E checks fail in the PR, but they pass using the same docker env locally.
We already have an issue to fix the flakiness.
tests/e2e/tests/_legacy-experience/woocommerce-blocks/sca-card.spec.js
Outdated
Show resolved
Hide resolved
@@ -158,11 +158,17 @@ function ( $id ) { | |||
$ids_to_migrate = $this->get_subs_ids_to_migrate(); | |||
|
|||
$this->logger_mock | |||
->expects( $this->at( 1 ) ) | |||
->expects( $this->exactly( 2 ) ) |
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.
Why do we need to update these tests? The new update_main_stripe_settings
does not log anything 🤷🏼
Do we know where is the additional log entry coming from?
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.
at()
was deprecated in PHPUnit 9. So, it threw many warnings when running the tests. I decided to refactor them here already. It is not a blocker, as we could wait for PHPUnit 10 (which removed this). I can also revert this if that is preferable.
…port payment method settings as well
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.
Thanks for the changes @wjrosa 🚢
Fixes #2411
Base PR: #3355
Changes proposed in this Pull Request:
This PR fixes issues when running the application on PHP 8.1. Basically, a new CI test node was added with this specific version, and deprecation issues were fixed. Especially calls to
get_option()
, as it can returnfalse
and it is not possible to automatically convert it to empty arrays anymore.To better solve the issue above, I have centralized the retrieval, update, and deletion of the main Stripe settings option on the
WC_Stripe_Helper
class, and replaced all calls to those functions with the new static methods.Initially, this PR should also add support for running tests with PHPUnit 10.5, but I dropped it since most of the base classes required to run our
wordpress-tests-lib
were removed on the major version. So, in order to progress with it we should also work onwordpress-tests-lib
first. There's a long conversation about this issue (3 years) here.Testing instructions
Code review should be enough. Check if the tests are still passing.
changelog.txt
andreadme.txt
(or does not apply)Post merge