[wp-trac] [WordPress Trac] #58776: Main query global not reset after tests
WordPress Trac
noreply at wordpress.org
Mon Jul 10 20:50:38 UTC 2023
#58776: Main query global not reset after tests
------------------------------+-----------------------
Reporter: flixos90 | Owner: flixos90
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: 6.3
Component: Build/Test Tools | Version:
Severity: normal | Keywords: has-patch
Focuses: |
------------------------------+-----------------------
Several core tests added in the past few releases of WordPress (mostly
related to lazy-loading) have been making use of the main query global
(`$wp_the_query`, different from `$wp_query`) and modifying it in tests.
It was assumed that that global was being reset between tests similar to
other query loop-related globals, but in https://github.com/WordPress
/wordpress-develop/pull/4799#issuecomment-1629114720 it was discovered
that the `$wp_the_query` global is not reset between tests, which is
unexpected behavior and caused problems with the tests in that PR.
This should be fixed so that the global is reset similar to the other
related globals like `$wp_query` and `$wp`. Similar to the regular
WordPress bootstrap process in `wp-settings.php`, the test suite should
ensure that `$wp_query` and `$wp_the_query` point to the same `WP_Query`
instance.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/58776>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list