Tests: Improve the On This Day dashboard widget tests#12634
Tests: Improve the On This Day dashboard widget tests#12634mukeshpanchal27 wants to merge 4 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.
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. |
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.