Skip to content

Tests: Remove redundant registration cleanup from presentation tests - #15191

Open
lancewillett wants to merge 2 commits into
WordPress:trunkfrom
lancewillett:cleanup/registry-presentation-65893
Open

lancewillett wants to merge 2 commits into
WordPress:trunkfrom
lancewillett:cleanup/registry-presentation-65893

Conversation

@lancewillett

@lancewillett lancewillett commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Core's inherited test setup resets ordinary post types, taxonomies, and non-built-in statuses before each test. Remove duplicate per-test cleanup while retaining scenario-specific unregister calls and unrelated fixture cleanup.

Keep the existing class callbacks in canonical.php, general/feedLinksExtra.php, and link/getEditTermLink.php. Class setup precedes per-test reset, so the per-test reset alone does not justify deleting those callbacks. Assertions and fixture creation remain unchanged.

See https://core.trac.wordpress.org/ticket/65893.

Validation on current trunk with this patch applied independently: PHP syntax and PHPCS passed. Randomized seed 15191 produced identical baseline/patched results: single-site 663 tests / 1,721 assertions; multisite 669 tests / 1,731 assertions. Default groups exclude AJAX. These runs bound compatibility; independent review of class-boundary behavior remains pending.

No new tests or assertions. Prepared with AI assistance (gpt-6).

@lancewillett
lancewillett requested a balanced review from Copilot October 29, 2026 22:03
@github-actions

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.

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

Props lancewillett.

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


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

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.

🟢 Approval recommended

No active review issues remain for the removal of redundant test registration cleanup.

No open issues 🎉

What changed in this PR

This PR simplifies WordPress presentation tests by removing registration cleanup added for #65893 that duplicates the shared per-test reset.

Changes:

  • Removes teardown overrides and calls that unregister ordinary post types, taxonomies, and custom post statuses.
  • Preserves assertions, scenario-specific unregister calls, and unrelated fixture cleanup.
  • Leaves the base test lifecycle and production code unchanged.
File Description
tests/​phpunit/​tests/​widgets/​wpWidgetTagCloud.php Removes taxonomy cleanup override.
tests/​phpunit/​tests/​sitemaps/​wpSitemapsUsers.php Removes post-type cleanup override.
tests/​phpunit/​tests/​sitemaps/​wpSitemapsTaxonomies.php Removes taxonomy cleanup override.
tests/​phpunit/​tests/​sitemaps/​wpSitemapsPosts.php Removes post-type cleanup override.
tests/​phpunit/​tests/​rewrite/​randomRewriteRules.php Removes registration cleanup; retains option cleanup.
tests/​phpunit/​tests/​oembed/​template.php Removes post-type cleanup; retains other teardown work.
tests/​phpunit/​tests/​oembed/​getOembedResponseData.php Removes custom post-status cleanup override.
tests/​phpunit/​tests/​oembed/​discovery.php Removes post-type cleanup override.
tests/​phpunit/​tests/​meta/​registerMeta.php Removes post-type cleanup; retains class fixture cleanup.
tests/​phpunit/​tests/​menu/​wpAjaxMenuQuickSearch.php Removes taxonomy and post-type cleanup override.
tests/​phpunit/​tests/​media/​getAttachmentTaxonomies.php Removes taxonomy cleanup override.
tests/​phpunit/​tests/​link/​wpForcePlainPostPermalink.php Removes custom post-status cleanup override.
tests/​phpunit/​tests/​link/​getPreviewPostLink.php Removes post-type cleanup override.
tests/​phpunit/​tests/​link/​getPostTypeArchiveFeedLink.php Removes post-type cleanup override.
tests/​phpunit/​tests/​link/​getEditTermLink.php Removes per-test and class-level taxonomy cleanup.
tests/​phpunit/​tests/​link/​getEditTagLink.php Removes taxonomy cleanup override.
tests/​phpunit/​tests/​link/​getAdjacentPost.php Removes taxonomy cleanup override.
tests/​phpunit/​tests/​link/​editTermLink.php Removes taxonomy cleanup override.
tests/​phpunit/​tests/​includes/​factory.php Removes taxonomy cleanup override.
tests/​phpunit/​tests/​general/​wpGetDocumentTitle.php Removes post-type cleanup override.
tests/​phpunit/​tests/​general/​feedLinksExtra.php Removes per-test and class-level registration cleanup.
tests/​phpunit/​tests/​functions/​wpGetArchives.php Removes post-type cleanup override.
tests/​phpunit/​tests/​customize/​nav-menus.php Removes taxonomy cleanup; retains scope cleanup.
tests/​phpunit/​tests/​customize/​nav-menu-item-setting.php Removes post-type cleanup; retains scope cleanup.
tests/​phpunit/​tests/​canonical.php Removes per-test and class-level post-type cleanup.

Review effort: Balanced

@lancewillett

Copy link
Copy Markdown
Member Author

Narrowed in 85fe4dc: retain the existing class callbacks in canonical, feed-link, and edit-term-link tests. The next per-test reset does not justify removing class-boundary cleanup. Randomized baseline/patched comparisons passed with identical counts (663 tests single-site; 669 multisite). Peter’s independent review remains pending.

AI review · gpt-6

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.

🔵 Needs a closer look

Registry resets occur after shared class setup, so removed teardowns may expose subsequent fixtures to leftover registrations, while reported subset runs exclude AJAX and do not establish full-suite class-boundary isolation.

No open issues 🎉

Review effort: Balanced

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.

2 participants