mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
Build/Test Tools: Fix comments odd/even instabilities (test leaks).
The odd / even class attribute global variables are causing issues in comments tests when a new test is added or an existing test is modified. To stabilize the odd / even comment tests, the comment global variables are added to the base test class' `tear_down()` using the same patterns as the other global resets. This change ensures each comment test starts at the same state. In doing so, the expected odd / even class attributes are no longer affected by previous tests, i.e. test leaks. Follow-up to [53172]. Props hellofromTonya, zieladam, peterwilsoncc. See #54725. git-svn-id: https://develop.svn.wordpress.org/trunk@53430 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -174,6 +174,12 @@ abstract class WP_UnitTestCase_Base extends PHPUnit_Adapter_TestCase {
|
||||
$GLOBALS[ $global ] = null;
|
||||
}
|
||||
|
||||
// Reset comment globals.
|
||||
$comment_globals = array( 'comment_alt', 'comment_depth', 'comment_thread_alt' );
|
||||
foreach ( $comment_globals as $global ) {
|
||||
$GLOBALS[ $global ] = null;
|
||||
}
|
||||
|
||||
/*
|
||||
* Reset $wp_sitemap global so that sitemap-related dynamic $wp->public_query_vars
|
||||
* are added when the next test runs.
|
||||
|
||||
Reference in New Issue
Block a user