Repository navigation
Tests: Clean up custom taxonomy in Tests_Block_Bindings_Term_Data_Source - #15502
devmuhib009 wants to merge 1 commit into
Conversation
…rce. 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 remain for the change centralizing private-taxonomy cleanup in per-test teardown.
No open issues 🎉
What changed in this PR
Centralizes private-taxonomy cleanup in the term-data block binding tests, ensuring cleanup runs even when an assertion fails.
Changes:
- Adds
tear_down()to call the publicunregister_taxonomy()API before parent teardown. - Removes redundant cleanup calls from the two private-taxonomy access tests.
| File | Description |
|---|---|
tests/phpunit/tests/block-bindings/termDataSource.php |
Moves wptests_private_tax cleanup into shared per-test teardown. |
Review effort: Balanced
lancewillett
left a comment
There was a problem hiding this comment.
Please keep the deletion of the two trailing _unregister_taxonomy() calls, but omit the new tear_down() method. In Core tests, inherited set_up() already resets taxonomies before the next test; _unregister_taxonomy() already delegates to the public API, so changing its spelling adds no benefit.
I compared trunk, this four-PR batch, and a deletion-only alternative: all pass 197 tests / 573 assertions in single site and multisite. Ordered existing tests across class boundaries also pass before/after deletion (10 tests / 66 assertions). Class fixtures run before the next reset, but I found no existing consumer that fails without this new teardown. Its isolation benefit remains unproven. The smaller deletion-only patch preserves all assertions and avoids new per-test machinery.
AI review · gpt-6
Trac ticket: https://core.trac.wordpress.org/ticket/65893
This PR cleans up the custom taxonomy
wptests_private_taxinTests_Block_Bindings_Term_Data_Source::tear_down()using the publicunregister_taxonomy()function, and removes redundant mid-test unregistration calls.