-
Notifications
You must be signed in to change notification settings - Fork 51
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
feat(corrections): Unit tests for Corrections functionality #3776
Conversation
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.
This looks great!
I added a small comment - feel free to merge once that function is removed (unless you disagree).
Don't forget to use the "Squash and Merge" option when hitting the merge button. :)
tests/unit-tests/corrections.php
Outdated
/** | ||
* Tear down test fixtures. | ||
*/ | ||
public function tear_down() { |
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.
This function is not necessary. WP_UnitTestCase cleans up between tests already.
tests/unit-tests/corrections.php
Outdated
|
||
Corrections::init(); | ||
|
||
self::$post_id = $this->factory->post->create( [ 'post_type' => 'post' ] ); |
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.
The direct use of the factory
field is deprecated. Not a big deal, but also very easy to fix by adding ()
: There is one more in the file further down too.
self::$post_id = $this->factory->post->create( [ 'post_type' => 'post' ] ); | |
self::$post_id = $this->factory()->post->create( [ 'post_type' => 'post' ] ); |
Thanks for taking a look! 🙇 @naxoc. Made the suggested changes ✅ . Merging this PR 🚀 |
Hey @Takshil-Kunadia, good job getting this PR merged! 🎉 Now, the Please check if this PR needs to be included in the "Upcoming Changes" and "Release Notes" doc. If it doesn't, simply remove the label. If it does, please add an entry to our shared document, with screenshots and testing instructions if applicable, then remove the label. Thank you! ❤️ |
# [6.0.0-alpha.2](v6.0.0-alpha.1...v6.0.0-alpha.2) (2025-02-27) ### Bug Fixes * **memberships:** ensure user membership is linked to the correct subscription ([#3768](#3768)) ([a942616](a942616)) * undo forcing WC order attribution to off ([#3771](#3771)) ([c9cb52a](c9cb52a)) * **woo:** page template meta leaking to other types ([#3782](#3782)) ([325a21c](325a21c)) ### Features * add corrections customize settings ([#3751](#3751)) ([11dbc5e](11dbc5e)) * **corrections:** Unit tests for Corrections functionality ([#3776](#3776)) ([ae58933](ae58933)) * **my-account:** add change email template ([#3772](#3772)) ([32bef3c](32bef3c)) * **my-account:** add pending email change state ([#3763](#3763)) ([c9ba046](c9ba046)) * **my-account:** verify email change ([#3764](#3764)) ([b50c980](b50c980))
🎉 This PR is included in version 6.0.0-alpha.2 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
All Submissions:
Changes proposed in this Pull Request:
This PR adds unit tests for the Corrections class methods. The tests cover functionality such as:
Enabling the corrections feature.
These tests will help ensure that any future changes to the Corrections class maintain expected behavior and improve overall code stability.
How to test the changes in this Pull Request:
vendor/bin/phpunit --filter Test_Corrections
.Other information: