Skip to content

Tests: Remove redundant post type cleanup in Tests_Comment_Query - #15498

Closed
devmuhib009 wants to merge 1 commit into
WordPress:trunkfrom
devmuhib009:test/cleanup-cpt-comment-query
Closed

devmuhib009 wants to merge 1 commit into
WordPress:trunkfrom
devmuhib009:test/cleanup-cpt-comment-query

Conversation

@devmuhib009

Copy link
Copy Markdown
Member

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

This PR removes redundant mid-test _unregister_post_type() calls in Tests_Comment_Query, as tear_down() already cleans up the custom post types via unregister_post_type().

@github-actions

github-actions Bot commented Nov 5, 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.

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

Props devmuhib, 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.

@lancewillett

Copy link
Copy Markdown
Member

Thanks, @devmuhib009. Holding this one for now, along with the rest of this series; see https://core.trac.wordpress.org/ticket/65893#comment:656 for why.

AI review · claude-opus-5-5

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 were identified for the removal of redundant post-type cleanup from two comment query tests.

No open issues 🎉

What changed in this PR

This PR simplifies Tests_Comment_Query cleanup by relying on the existing tear_down() method to unregister custom post types.

Changes:

  • Removes redundant _unregister_post_type() calls from test_post_type_single_value() and test_post_type_singleton_array().
  • Leaves test assertions and production code unchanged.
File Description
tests/​phpunit/​tests/​comment/​query.php Removes duplicate post type cleanup from two comment query tests.

Review effort: Balanced

@lancewillett lancewillett left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Revisited the hold from #65893 comment 656. Both removed pairs of unregister calls follow their final assertion; they are not part of either scenario. The custom post types have no automatic-reset opt-out. On current trunk, inherited setup resets them before each Core test; the local teardown mentioned in the description has since been removed. Please update that explanation when convenient.

The four-class comparison passes 197 tests / 573 assertions before and after in single site and multisite (random seed 65893). Explicit class-boundary ordering also passes 10 tests / 66 assertions: each changed comment test ends its class before the existing hierarchical-slug test runs. That consumer registers its own types after inherited setup. No tests or assertions are removed, and no runtime improvement is claimed.

AI review · gpt-6

wporg-sync pushed a commit that referenced this pull request Nov 10, 2026
Remove final taxonomy and post type cleanup calls already covered by the inherited per-test setup.

Developed in: #15497, #15498

Props devmuhib.
See #65893.


git-svn-id: https://develop.svn.wordpress.org/trunk@65397 602fd350-edb4-49c9-b593-d223f7449a82
@lancewillett

Copy link
Copy Markdown
Member

wporg-sync pushed a commit to WordPress/WordPress that referenced this pull request Nov 10, 2026
Remove final taxonomy and post type cleanup calls already covered by the inherited per-test setup.

Developed in: WordPress/wordpress-develop#15497, WordPress/wordpress-develop#15498

Props devmuhib.
See #65893.

Built from https://develop.svn.wordpress.org/trunk@65397


git-svn-id: http://core.svn.wordpress.org/trunk@64536 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

3 participants