mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
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:
@@ -285,10 +285,6 @@ class Tests_REST_API extends WP_UnitTestCase {
|
||||
* @ticket 34299
|
||||
*/
|
||||
public function test_rest_url_scheme() {
|
||||
if ( isset( $_SERVER['HTTPS'] ) ) {
|
||||
$_https = $_SERVER['HTTPS'];
|
||||
}
|
||||
$_name = $_SERVER['SERVER_NAME'];
|
||||
$_SERVER['SERVER_NAME'] = parse_url( home_url(), PHP_URL_HOST );
|
||||
$_siteurl = get_option( 'siteurl' );
|
||||
|
||||
@@ -321,12 +317,6 @@ class Tests_REST_API extends WP_UnitTestCase {
|
||||
$this->assertSame( 'http', parse_url( $url, PHP_URL_SCHEME ) );
|
||||
|
||||
// Reset
|
||||
if ( isset( $_https ) ) {
|
||||
$_SERVER['HTTPS'] = $_https;
|
||||
} else {
|
||||
unset( $_SERVER['HTTPS'] );
|
||||
}
|
||||
$_SERVER['SERVER_NAME'] = $_name;
|
||||
update_option( 'siteurl', $_siteurl );
|
||||
set_current_screen( 'front' );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user