Skip to content

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

Open
mukeshpanchal27 wants to merge 4 commits into
WordPress:trunkfrom
mukeshpanchal27:fix/follow-up-65116
Open

Tests: Improve the On This Day dashboard widget tests#12634
mukeshpanchal27 wants to merge 4 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.
Copilot AI review requested due to automatic review settings July 22, 2026 07:23
@mukeshpanchal27 mukeshpanchal27 self-assigned this Jul 22, 2026

Copilot AI 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 thread tests/phpunit/tests/admin/wpOnThisDay.php Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI 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.

Copilot AI 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-actions Bot 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.

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

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

Copilot AI 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.

Sign up for free to 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.

3 participants