Skip to content

Tests: Remove redundant trailing taxonomy cleanup in Tests_Query_TaxQuery - #16272

Closed
shail-mehta wants to merge 1 commit into
WordPress:trunkfrom
shail-mehta:tests/66755-remove-redundant-taxonomy-cleanup-tax-query
Closed

shail-mehta wants to merge 1 commit into
WordPress:trunkfrom
shail-mehta:tests/66755-remove-redundant-taxonomy-cleanup-tax-query

Conversation

@shail-mehta

Copy link
Copy Markdown
Member

Trac ticket: #66755

What

Removes 13 trailing _unregister_taxonomy() calls for foo, foo1, and bar from 9 tests in Tests_Query_TaxQuery (tests/phpunit/tests/query/taxQuery.php). The wptests_* cleanup in test_tax_query_operator_not_exists_combined() is unchanged.

Why

Each taxonomy is registered inside its test body. reset_taxonomies() in WP_UnitTestCase_Base::set_up() already resets taxonomies before every core test, so the trailing calls add nothing.

How

Delete the 13 trailing _unregister_taxonomy() calls and the blank lines they leave behind.

Testing Instructions

Run the class in default and reverse order, and the query group:

npm run test:php -- --filter Tests_Query_TaxQuery
npm run test:php -- --order-by=reverse --filter Tests_Query_TaxQuery
npm run test:php -- --group query

Use of AI Tools

  • Cursor

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

There are no active review issues for the change removing redundant taxonomy cleanup.

No open issues 🎉

What changed in this PR

Simplifies Tests_Query_TaxQuery by removing redundant taxonomy cleanup, relying on the shared test setup to reset taxonomies before each test.

Changes:

  • Removes 13 _unregister_taxonomy() calls across 9 tests, along with leftover blank lines.
  • Leaves assertions and the wptests_* cleanup unchanged.
File Description
tests/​phpunit/​tests/​query/​taxQuery.php Removes redundant cleanup for the foo, foo1, and bar taxonomies.

Review effort: Balanced

@shail-mehta
shail-mehta marked this pull request as ready for review November 26, 2026 16:39
@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 shailu25.

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 or WordPress.org 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 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.

All 13 calls follow the query they were set up for. The assertions read results already returned, and Core resets these taxonomies before the next test. That makes the deletions safe across all nine methods.

AI review · gpt-6.2-astra

wporg-sync pushed a commit that referenced this pull request Nov 28, 2026
… classes.

Core resets these registrations before each test. Remove the trailing unregister calls from the admin bar, query, REST icon collection and block template tests. Keep the icon collection cleanup for its separate registry.

Developed in: #16267, #16268, #16269, #16272, #16274

Props shailu25, devmuhib, huzaifaalmesbah, peterwilsoncc, mukesh27.
See #66755.


git-svn-id: https://develop.svn.wordpress.org/trunk@65815 602fd350-edb4-49c9-b593-d223f7449a82
wporg-sync pushed a commit to WordPress/WordPress that referenced this pull request Nov 28, 2026
… classes.

Core resets these registrations before each test. Remove the trailing unregister calls from the admin bar, query, REST icon collection and block template tests. Keep the icon collection cleanup for its separate registry.

Developed in: WordPress/wordpress-develop#16267, WordPress/wordpress-develop#16268, WordPress/wordpress-develop#16269, WordPress/wordpress-develop#16272, WordPress/wordpress-develop#16274

Props shailu25, devmuhib, huzaifaalmesbah, peterwilsoncc, mukesh27.
See #66755.

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


git-svn-id: http://core.svn.wordpress.org/trunk@64844 1a063a9b-81f0-0310-95a4-ce76da25c4cd
@lancewillett

Copy link
Copy Markdown
Member

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