From 1fc028716424213cdcded5c02ce69da16005211f Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Fri, 24 Oct 2014 00:58:35 +0000 Subject: [PATCH] Set current user to 0 after each unit test. This prevents $current_user, $userdata, and other user-related globals from being polluted if a previous test does not properly reset the current user. Props nacin, mnelson4. Fixes #29712. git-svn-id: https://develop.svn.wordpress.org/trunk@30001 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/includes/testcase.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/phpunit/includes/testcase.php b/tests/phpunit/includes/testcase.php index 3e4065644e..39d97d06d3 100644 --- a/tests/phpunit/includes/testcase.php +++ b/tests/phpunit/includes/testcase.php @@ -70,6 +70,7 @@ class WP_UnitTestCase extends PHPUnit_Framework_TestCase { remove_filter( 'query', array( $this, '_drop_temporary_tables' ) ); remove_filter( 'wp_die_handler', array( $this, 'get_wp_die_handler' ) ); $this->_restore_hooks(); + wp_set_current_user( 0 ); } function clean_up_global_scope() {