[wp-trac] [WordPress Trac] #58776: Main query global not reset after tests

WordPress Trac noreply at wordpress.org
Tue Jul 11 13:31:17 UTC 2023


#58776: Main query global not reset after tests
---------------------------------------------+-----------------------
 Reporter:  flixos90                         |       Owner:  flixos90
     Type:  defect (bug)                     |      Status:  closed
 Priority:  normal                           |   Milestone:  6.3
Component:  Build/Test Tools                 |     Version:
 Severity:  normal                           |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests commit  |     Focuses:
---------------------------------------------+-----------------------
Changes (by joemcgill):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [changeset:"56212" 56212]:
 {{{
 #!CommitTicketReference repository="" revision="56212"
 Build/Test Tools: Reset main query object after each test.

 This resets the main query variable, `$wp_the_query` during the
 `WP_UnitTestCase_Base::tear_down` method that runs after each PHPUnit
 test. This ensures any changes to the main query object is reset after
 each test to avoid cross contamination between tests, similar to how other
 globals are reset.

 Props flixos90, spacedmonkey, joemcgill.
 Fixes #58776.
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/58776#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list