Repository navigation
Tests: Unregister custom taxonomy in getAllCategoryIds.php - #15099
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:
|
|
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/phpunit/tests/category/getAllCategoryIds.php,register_taxonomy()is used intest_get_all_category_ids()to register a custom taxonomy'test_tax_cat'.While the test calls
_unregister_taxonomy()before the final assertion, an assertion failure before or at that point can leave'test_tax_cat'registered in the global$wp_taxonomiesarray, leaking state into subsequent tests.This PR adds a
tear_down()method inTests_Category_GetAllCategoryIdsto reliably unregister'test_tax_cat'viaunregister_taxonomy(), ensuring complete test isolation.Trac ticket: https://core.trac.wordpress.org/ticket/65893
This pull request modifies test files only.
Summary of Changes
tear_down()method toTests_Category_GetAllCategoryIdsintests/phpunit/tests/category/getAllCategoryIds.phpunregistering'test_tax_cat'.Test Coverage
vendor/bin/phpunit --filter Tests_Category_GetAllCategoryIds(1 test, 2 assertions: all passed).vendor/bin/phpcs tests/phpunit/tests/category/getAllCategoryIds.php(0 errors, 0 warnings).Use of AI Tools
getAllCategoryIds.phpand drafting teardown cleanup.