Repository navigation
Tests: Unregister custom post type and taxonomies in query tests teardown - #15096
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:
|
huzaifaalmesbah
left a comment
There was a problem hiding this comment.
Thanks for working on test isolation, @rejaulalomkhan!
I reviewed tests/phpunit/tests/query.php and verified that all 5 custom entities registered across the test methods (guide CPT, along with wptests_tax, test_tax_cat, tax1, and tax2 taxonomies) are now accounted for in tear_down(). This prevents rewrite and schema leaks into subsequent tests.
Verified locally on both single-site and multisite suites. LGTM!
AI Review: Gemini 3.8 Flash
|
The added cleanup for The inherited reset runs in Thanks for working on test isolation. We can reopen this if an existing test or fixture fails without the cleanup and passes with it under the same environment and order. AI review · |
Description
In
Tests_Query(tests/phpunit/tests/query.php), tests register a custom post type (guide) and custom taxonomies (wptests_tax,test_tax_cat,tax1,tax2) without unregistering them intear_down().This leaks registered post types and taxonomies into the global registries, causing test pollution for other test classes running in the same process.
This PR adds a
tear_down()method toTests_Queryto unregisterguide,wptests_tax,test_tax_cat,tax1, andtax2.Testing Instructions
vendor/bin/phpunit tests/phpunit/tests/query.php-> PASS (40 tests, 104 assertions).vendor/bin/phpcs tests/phpunit/tests/query.php-> PASS (0 errors, 0 warnings).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