Repository navigation
Tests: Clean up test_tax_cat custom taxonomy in Tests_Category_GetAllCategoryIds - #15503
devmuhib009 wants to merge 1 commit into
Conversation
…CategoryIds. See #65893. Props devmuhib009.
|
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: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
|
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 · |
There was a problem hiding this comment.
🟢 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 publicunregister_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
left a comment
There was a problem hiding this comment.
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
Trac ticket: https://core.trac.wordpress.org/ticket/65893
This PR unregisters custom taxonomy
test_tax_catinTests_Category_GetAllCategoryIds::tear_down()using the publicunregister_taxonomy()function, ensuring proper fixture cleanup and removing the mid-test unregistration call.