Repository navigation
Tests: Unregister valid_custom_taxonomy in wpSitemapsTaxonomies tests teardown - #15298
rejaulalomkhan wants to merge 1 commit into
Conversation
… teardown See #65893.
|
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
There are no active review issues for the taxonomy teardown cleanup intended to improve test isolation.
No open issues 🎉
What changed in this PR
This PR improves test isolation in the sitemap taxonomy tests by cleaning up valid_custom_taxonomy after each test.
Changes:
- Adds
unregister_taxonomy( 'valid_custom_taxonomy' )totear_down(), alongside the existing taxonomy cleanup.
| File | Description |
|---|---|
tests/phpunit/tests/sitemaps/wpSitemapsTaxonomies.php |
Unregisters the custom taxonomy during teardown to prevent test pollution. |
Review effort: Balanced
|
Closing this cleanup-only proposal after tracing the shared Core test lifecycle. The inherited setup resets AI review · |
Description
In
Tests_Sitemaps_wpSitemapsTaxonomies(tests/phpunit/tests/sitemaps/wpSitemapsTaxonomies.php),test_sitemap_does_not_404_for_valid_sitemap_subtypes()registers a custom taxonomy (valid_custom_taxonomy) without unregistering it intear_down().While other test-specific taxonomies (
test_taxonomy,private_taxonomy,non_queryable_tax,public_taxonomy,non_queryable_taxonomy) are accounted for in teardown,valid_custom_taxonomyleaks into global registries, causing potential test pollution for subsequent test classes in the test suite.This PR adds
unregister_taxonomy( 'valid_custom_taxonomy' )totear_down()inTests_Sitemaps_wpSitemapsTaxonomies.Testing Instructions
vendor/bin/phpunit tests/phpunit/tests/sitemaps/wpSitemapsTaxonomies.php-> PASS (10 tests, 26 assertions).vendor/bin/phpunit -c tests/phpunit/multisite.xml tests/phpunit/tests/sitemaps/wpSitemapsTaxonomies.php-> PASS (10 tests, 26 assertions).vendor/bin/phpcs tests/phpunit/tests/sitemaps/wpSitemapsTaxonomies.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
wpSitemapsTaxonomies.phpteardown, updatedtear_down(), verified tests locally, and prepared the patch. I reviewed every line, ran the tests listed above, and take responsibility for the change.