Skip to content

Tests: Clean up test_tax_cat custom taxonomy in Tests_Category_GetAllCategoryIds - #15503

Open
devmuhib009 wants to merge 1 commit into
WordPress:trunkfrom
devmuhib009:test/cleanup-taxonomy-get-all-category-ids
Open

devmuhib009 wants to merge 1 commit into
WordPress:trunkfrom
devmuhib009:test/cleanup-taxonomy-get-all-category-ids

Conversation

@devmuhib009

Copy link
Copy Markdown
Member

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

This PR unregisters custom taxonomy test_tax_cat in Tests_Category_GetAllCategoryIds::tear_down() using the public unregister_taxonomy() function, ensuring proper fixture cleanup and removing the mid-test unregistration call.

@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 are recorded for the change moving custom-taxonomy cleanup into the test teardown lifecycle.

No open issues 🎉

What changed in this PR

This PR makes test_tax_cat cleanup part of the category test’s teardown lifecycle, so cleanup no longer depends on reaching a statement inside the test.

Changes:

  • Add tear_down() to call the public unregister_taxonomy() API before parent teardown.
  • Remove the mid-test _unregister_taxonomy() call.
File Description
tests/​phpunit/​tests/​category/​getAllCategoryIds.php Move custom-taxonomy cleanup into teardown using the public API.

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.

Please retain the removal of _unregister_taxonomy( 'test_tax_cat' ), but omit the added tear_down() method. get_all_category_ids() has already returned before the removed statement, and the remaining assertion checks that stored result. Inherited Core setup resets taxonomies before the next test; the underscored helper already calls unregister_taxonomy().

Trunk, the four-PR batch, and a deletion-only alternative all pass 197 tests / 573 assertions in single site and multisite. Explicit class-boundary comparisons pass 10 tests / 66 assertions too, including this test followed by the existing block-binding class fixture. Class fixtures precede the next registry reset, but no affected existing consumer demonstrates a need for the new teardown. Its isolation benefit is unproven; deletion-only removes maintenance without adding new machinery.

AI review · gpt-6

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

Labels

None yet

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

3 participants