Uh oh!
There was an error while loading. Please reload this page.
Tests: Improve the On This Day dashboard widget tests - #12634
Tests: Improve the On This Day dashboard widget tests#12634mukeshpanchal27 wants to merge 8 commits into
Conversation
Refactor tests to use static user IDs for consistency and clarity.
There was a problem hiding this comment.
Pull request overview
This PR is a test-only maintenance refactor for the On This Day dashboard widget PHPUnit tests, aiming to reduce duplicated setup and make author fixtures consistent across the test class.
Changes:
- Added shared author fixtures (
self::$user_id,self::$other_user_id) inwpSetUpBeforeClass()and updated tests to reuse them. - Added
@ticket 65116annotations to the relevant test methods for discoverability/grouping by ticket.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
joedolson
left a comment
There was a problem hiding this comment.
This all makes sense to me.
Uh oh!
There was an error while loading. Please reload this page.
Add wpTearDownAfterClass method to clean up users.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Includes: * Adding the missing `@ticket 65116` annotation to each test method, so the tests are discoverable via the ticket group as required by the core test conventions. * Moving the repeated author user creation into shared `wpSetUpBeforeClass()` fixtures. * Renaming the test class to match the `wp_dashboard_on_this_day()` function name. No production code is touched and no test assertions change; this only reduces duplicated setup and the number of users created per test run. Developed in #12634. Follow-up to [62681]. Props mukesh27, westonruter, joedolson, SergeyBiryukov. See #65116, #64894. git-svn-id: https://develop.svn.wordpress.org/trunk@62852 602fd350-edb4-49c9-b593-d223f7449a82
Includes: * Adding the missing `@ticket 65116` annotation to each test method, so the tests are discoverable via the ticket group as required by the core test conventions. * Moving the repeated author user creation into shared `wpSetUpBeforeClass()` fixtures. * Renaming the test class to match the `wp_dashboard_on_this_day()` function name. No production code is touched and no test assertions change; this only reduces duplicated setup and the number of users created per test run. Developed in WordPress/wordpress-develop#12634. Follow-up to [62681]. Props mukesh27, westonruter, joedolson, SergeyBiryukov. See #65116, #64894. Built from https://develop.svn.wordpress.org/trunk@62852 git-svn-id: http://core.svn.wordpress.org/trunk@62132 1a063a9b-81f0-0310-95a4-ce76da25c4cd
t-hamano
commented
Jul 27, 2026
I attempted to resolve the code conflicts, and the diff became zero. It seems this was caused by the PR already being committed. This PR can now be closed. |
Refactor tests to use static user IDs for consistency and clarity.
Trac ticket: https://core.trac.wordpress.org/ticket/65116
Follow-up to https://core.trac.wordpress.org/changeset/62681, which added the On This Day dashboard widget along with its test coverage. This PR is a test-only maintenance pass on
Tests_Admin_wpOnThisDay:@ticket 65116annotation to each test method, so the tests are discoverable via the ticket group as required by the core test conventions.wpSetUpBeforeClass()fixtures (self::$user_idandself::$other_user_id), replacing the per-testself::factory()->user->create()calls. The two users now carry theCurrent Writer/Guest Writerdisplay names thattest_widget_labels_posts_from_other_authors()previously created inline, so every test shares one consistent set of authors.No production code is touched and no test assertions change; this only reduces duplicated setup and the number of users created per test run.
Use of AI Tools
Use for drafting PR details.
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.