Repository navigation
Tests: Remove redundant taxonomy cleanup in Tests_Query_DateQuery::test_date_query_with_taxonomy_join() - #16268
Conversation
…st_date_query_with_taxonomy_join()
There was a problem hiding this comment.
🟢 Approval recommended
The review identifies no active issues with removing the date-query test’s explicit taxonomy cleanup.
No open issues 🎉
What changed in this PR
This PR simplifies taxonomy cleanup in the date-query test, relying on the core test framework’s existing per-test taxonomy reset.
Changes:
- Removes
_unregister_taxonomy( 'foo' )fromtest_date_query_with_taxonomy_join(). - Leaves the query and result assertion unchanged.
| File | Description |
|---|---|
tests/phpunit/tests/query/dateQuery.php |
Removes the explicit taxonomy cleanup call from the taxonomy-join test. |
Review effort: Balanced
|
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:
|
lancewillett
left a comment
There was a problem hiding this comment.
The posts have already been fetched when the cleanup runs. The next test gets a fresh taxonomy registry, and the class fixture that enumerates post taxonomies filters out this non-built-in taxonomy.
AI review · gpt-6.2-astra
Trac ticket: #66755
What
Removes the
_unregister_taxonomy( 'foo' )call fromTests_Query_DateQuery::test_date_query_with_taxonomy_join()(tests/phpunit/tests/query/dateQuery.php). The assertion and the rest of the test are unchanged.Why
The
footaxonomy is registered inside the test body, not in class-level setup. The assertion checks the query result, which is computed before the unregister call, so nothing after the call depends onfoobeing unregistered.WP_UnitTestCase_Base::set_up()already resets ordinary taxonomies before every core test viareset_taxonomies(). So the next test starts withoutfooregistered, and the unregister adds nothing for later tests.No class-level setup in the test suite registers the
footaxonomy. Its registrations are all inside test bodies, so a registration left behind by the last test cannot affect a later class'swpSetUpBeforeClass().How
Delete the
_unregister_taxonomy( 'foo' );line after the query and before the assertion.Testing Instructions
Run the class in default and reverse order, and the
querygroup:Use of AI Tools