Remove (or at least reduce) the need to reset common $_SERVER variables before assertions or between tests, by introducing a method which automatically resets them during test setup.

See #35954


git-svn-id: https://develop.svn.wordpress.org/trunk@36721 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
John Blackbourn
2016-02-26 02:08:47 +00:00
parent 825e2e45fe
commit 1ebe4658f1
8 changed files with 12 additions and 51 deletions

View File

@@ -101,6 +101,7 @@ class WP_UnitTestCase extends PHPUnit_Framework_TestCase {
$this->reset_post_types();
$this->reset_taxonomies();
$this->reset_post_statuses();
$this->reset__SERVER();
if ( $wp_rewrite->permalink_structure ) {
$this->set_permalink_structure( '' );
@@ -185,6 +186,13 @@ class WP_UnitTestCase extends PHPUnit_Framework_TestCase {
}
}
/**
* Reset `$_SERVER` variables
*/
protected function reset__SERVER() {
tests_reset__SERVER();
}
/**
* Saves the action and filter-related globals so they can be restored later.
*