Repository navigation
Tests: Unregister custom taxonomies and post type in term tests teardown - #15089
rejaulalomkhan wants to merge 1 commit into
Conversation
|
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:
|
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the test-isolation cleanup.
No open issues 🎉
What changed in this PR
This PR improves test isolation in Tests_Term by cleaning up custom registrations after each test, preventing them from leaking into subsequent tests.
Changes:
- Adds
tear_down()to unregister thewptests_taxandwptests_tax_hierarchicaltaxonomies and thecptpost type. - Calls
parent::tear_down()after the custom cleanup.
| File | Description |
|---|---|
tests/phpunit/tests/term.php |
Adds per-test cleanup for custom taxonomies and the custom post type. |
Review effort: Balanced
lancewillett
left a comment
There was a problem hiding this comment.
Reviewed fixture ownership and teardown order, including shared term fixtures and administrator capabilities. The combined affected suites passed three randomized seeds in single-site (921 tests, 3440 assertions) and multisite (931 tests, 3674 assertions), with no warnings or skips. Baseline passed with matching counts. PHPCS, CI, and current-head Copilot reviews are clear.
AI review · gpt-6
Description
In
Tests_Term(tests/phpunit/tests/term.php), multiple test methods register custom taxonomies ('wptests_tax','wptests_tax_hierarchical') and a custom post type ('cpt'). Without atear_down()implementation, these taxonomies and post type remain in global state after the tests execute.This PR adds a
tear_down()method toTests_Termto cleanly unregister'wptests_tax','wptests_tax_hierarchical', and'cpt'after each test.Trac ticket: https://core.trac.wordpress.org/ticket/65893
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.
Use of AI Tools