Skip to content

Tests: Improve the On This Day dashboard widget tests - #12634

Closed
mukeshpanchal27 wants to merge 8 commits into
WordPress:trunkfrom
mukeshpanchal27:fix/follow-up-65116
Closed

Tests: Improve the On This Day dashboard widget tests#12634
mukeshpanchal27 wants to merge 8 commits into
WordPress:trunkfrom
mukeshpanchal27:fix/follow-up-65116

Conversation

@mukeshpanchal27

Copy link
Copy Markdown
Member

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:

  • Adds 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.
  • Moves the repeated author user creation into shared wpSetUpBeforeClass() fixtures (self::$user_id and self::$other_user_id), replacing the per-test self::factory()->user->create() calls. The two users now carry the Current Writer / Guest Writer display names that test_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.

Refactor tests to use static user IDs for consistency and clarity.
CopilotAI review requested due to automatic review settings July 22, 2026 07:23
@mukeshpanchal27mukeshpanchal27 self-assigned this Jul 22, 2026

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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) in wpSetUpBeforeClass() and updated tests to reuse them.
  • Added @ticket 65116 annotations to the relevant test methods for discoverability/grouping by ticket.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadtests/phpunit/tests/admin/wpOnThisDay.php Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
CopilotAI review requested due to automatic review settings July 22, 2026 07:27
@github-actions

Copy link
Copy Markdown

Test using WordPress Playground

The 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

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@mukeshpanchal27
mukeshpanchal27 marked this pull request as ready for review July 22, 2026 07:40
@github-actions

github-actionsBot commented Jul 22, 2026

Copy link
Copy Markdown

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 props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props mukesh27, westonruter, wildworks, joedolson.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

CopilotAI review requested due to automatic review settings July 23, 2026 04:50

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@joedolsonjoedolson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This all makes sense to me.

CopilotAI review requested due to automatic review settings July 25, 2026 03:41

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment threadtests/phpunit/tests/admin/wpOnThisDay.php
Add wpTearDownAfterClass method to clean up users.
CopilotAI review requested due to automatic review settings July 25, 2026 03:50

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment threadtests/phpunit/tests/admin/wpOnThisDay.php Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
CopilotAI review requested due to automatic review settings July 25, 2026 03:53

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

pento pushed a commit that referenced this pull request Jul 26, 2026
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
markjaquith pushed a commit to markjaquith/WordPress that referenced this pull request Jul 26, 2026
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
CopilotAI review requested due to automatic review settings July 27, 2026 08:39

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot wasn't able to review any files in this pull request.

@t-hamano

Copy link
Copy Markdown
Contributor

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.

https://core.trac.wordpress.org/changeset/62852

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@mukeshpanchal27@t-hamano@joedolson@westonruter