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

Apply Rector suggestions for PHP 8.1 #43230

Merged
merged 4 commits into from Jan 26, 2024
Merged

Apply Rector suggestions for PHP 8.1 #43230

merged 4 commits into from Jan 26, 2024

Conversation

asumaran
Copy link
Contributor

@asumaran asumaran commented Jan 2, 2024

Submission Review Guidelines:

Changes proposed in this Pull Request:

Subset of WPCOM changes for PHP 8.1 compatibility based on the D129164-code diff.

Ref: p7H4VZ-4x1-p2

How to test the changes in this Pull Request:

The changes on this PR are based on changes currently made in WPCOM, As there are no logic changes, only compatibility with PHP 8.1, it was deemed unnecessary to include testing instructions. To put it simply, the current tests should be able to complete without any problems, and that should be sufficient.

In any case, I'm including testing instructions for these changes.

plugins/woocommerce/includes/wc-notice-functions.php
plugins/woocommerce/includes/wc-cart-functions.php

  • Verify notice is still shown after adding a product to the cart and the option “Redirect to the cart page after successful addition” is checked.

plugins/woocommerce/includes/wc-cart-functions.php

  • Verify adding product to the cart while rates and shipping are enabled work as expected.

plugins/woocommerce/includes/wc-order-functions.php

  • Verify refunds works as usual

plugins/woocommerce/includes/wc-product-functions.php

  • Verify product prices are correct including tax
  • Verify product prices are correct excluding tax

plugins/woocommerce/includes/wc-template-functions.php

  • unfortunately we can't test this one as the wc_display_item_downloads isn’t used anywhere in WooCommerce.
  • However, I made sure wc_display_item_downloads is working as expected by calling the method manually. It displays the download links as expected
    Screenshot 2024-01-24 at 17 04 53

Changelog entry

  • Automatically create a changelog entry from the details below.

Significance

  • Patch
  • Minor
  • Major

Type

  • Fix - Fixes an existing bug
  • Add - Adds functionality
  • Update - Update existing functionality
  • Dev - Development related task
  • Tweak - A minor adjustment to the codebase
  • Performance - Address performance issues
  • Enhancement - Improvement to existing functionality

Message

Comment

@asumaran asumaran self-assigned this Jan 2, 2024
@github-actions github-actions bot added the plugin: woocommerce Issues related to the WooCommerce Core plugin. label Jan 2, 2024
Copy link
Contributor

github-actions bot commented Jan 2, 2024

Test Results Summary

Commit SHA: ec6ba75

Test 🧪Passed ✅Failed 🚨Broken 🚧Skipped ⏭️Unknown ❔Total 📊Duration ⏱️
API Tests25900202610m 38s
E2E Tests28700602936m 58s

To view the full API test report, click here.
To view the full E2E test report, click here.
To view all test reports, visit the WooCommerce Test Reports Dashboard.

Copy link
Contributor

@prettyboymp prettyboymp left a comment

Choose a reason for hiding this comment

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

Changes look good.

@asumaran asumaran marked this pull request as ready for review January 12, 2024 22:53
Copy link
Contributor

github-actions bot commented Jan 16, 2024

Hi @prettyboymp, @Konamiman,

Apart from reviewing the code changes, please make sure to review the testing instructions as well.

You can follow this guide to find out what good testing instructions should look like:
https://github.com/woocommerce/woocommerce/wiki/Writing-high-quality-testing-instructions

@asumaran asumaran requested review from a team and Konamiman and removed request for a team January 17, 2024 21:54
@Konamiman
Copy link
Contributor

Hi, changes look good on my side too but would it be possible to have testing instructions please? Or do these changes como from a pull request (or similar) with its own testing instructions?

@asumaran
Copy link
Contributor Author

@Konamiman, I've updated the testing instructions section in the PR description. I don't think adding testing instructions is necessary as the PR does not introduce or modify existing functionality but refactors for PHP 8.1. Unless @prettyboymp has something to add?

@Konamiman
Copy link
Contributor

I don't think adding testing instructions is necessary as the PR does not introduce or modify existing functionality but refactors for PHP 8.1.

Just a general note: testing instructions aren't only for new or modified functionality, they are also valuable to ensure that nothing breaks after a refactor.

The changes look good to me so I'll approve the PR, but since I haven't really tested anything beyond the visual inspection I'll add the "needs analysis" label.

@Konamiman Konamiman added the needs: analysis Indicates if the PR requires a PR testing scrub session. label Jan 23, 2024
@alopezari
Copy link
Contributor

Thanks for the heads up @Konamiman!

@asumaran even if there aren't any logical changes, regression issues might raise. Considering WooCommerce is a complex application with tons of flows, would you suggest any specific existing flows we should test more carefully to cover potential side effects caused by these changes?

@asumaran
Copy link
Contributor Author

asumaran commented Jan 23, 2024

@alopezari, this PR is part of a series of PRs I've created to push upstream the changes already made in WPCOM. As these shouldn't change the code logic, I didn't consider adding testing steps.

Given the changes cover practically the entire WooCommerce extension, adding testing steps for each PR will take a while since I need to get familiar with the context of each change beyond the refactor.

In the meantime, I'll put the open PRs on hold until testing steps are added and focus on adding test instructions to the merged PRs.

cc @prettyboymp In case wants something to add.

@asumaran asumaran marked this pull request as draft January 23, 2024 18:26
@prettyboymp
Copy link
Contributor

Hi @alopezari, as @asumaran mentioned, these changes are purely to deal with errors that are now escalated to a new level in PHP8. This includes logic paths that potentially use undefined variables, or attempt to iterate non-iterable or non-countable values.
These are changes that we're having to re-apply each time we update WooCommerce in production to be sure the the transition to PHP8 on our servers won't suddenly cause fatal errors. Each in itself is relatively simple data check.

@alopezari
Copy link
Contributor

Thanks @asumaran @prettyboymp!

We plan to cover these PRs as part of the critical flows testing (WooCommerce & WooCommerce Blocks.

I understand these are minor changes that don't alter WooCommerce's functionality, I was just a bit worried about the lack of testing instructions since every single line of code could break the entire app. We test our critical flows for every release, so theoretically that would cover these changes. However, we would appreciate if you could share some flows affected by these changes so that we can pay special attention to them (also known as targeted or selective regression testing). There is no need to define an exhaustive test plan or process, just some simple indications would be great. Otherwise we will just test our critical flows as usual.

Thanks!

@alopezari alopezari removed the needs: analysis Indicates if the PR requires a PR testing scrub session. label Jan 24, 2024
@asumaran asumaran marked this pull request as ready for review January 24, 2024 22:39
@asumaran
Copy link
Contributor Author

@alopezari I've added testing instructions to the PR's description. @Konamiman Please feel free to merge.

@alopezari
Copy link
Contributor

Thank you very much @asumaran! Much appreciated 🙌

@asumaran
Copy link
Contributor Author

@Konamiman Plese merge the PR. I've added testing instructions.

@Konamiman Konamiman merged commit a656fe0 into trunk Jan 26, 2024
41 checks passed
@Konamiman Konamiman deleted the as-diff-D129164 branch January 26, 2024 15:25
@github-actions github-actions bot added this to the 8.7.0 milestone Jan 26, 2024
@github-actions github-actions bot added the needs: analysis Indicates if the PR requires a PR testing scrub session. label Jan 26, 2024
@veljkho veljkho added status: analysis complete Indicates if a PR has been analysed by Solaris and removed needs: analysis Indicates if the PR requires a PR testing scrub session. labels Jan 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin: woocommerce Issues related to the WooCommerce Core plugin. status: analysis complete Indicates if a PR has been analysed by Solaris
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants