From 2860548f5bb7512b0c24ddb36bd493a2186fe72a Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Tue, 16 Jun 2015 00:03:25 +0000 Subject: [PATCH] Set `$_SERVER['REQUEST_METHOD']` for unit tests. Props johnbillion. Fixes #32636. git-svn-id: https://develop.svn.wordpress.org/trunk@32785 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/includes/bootstrap.php | 1 + tests/phpunit/includes/install.php | 1 + tests/phpunit/tests/auth.php | 2 -- 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/phpunit/includes/bootstrap.php b/tests/phpunit/includes/bootstrap.php index 575954bb52..a9627c4c47 100644 --- a/tests/phpunit/includes/bootstrap.php +++ b/tests/phpunit/includes/bootstrap.php @@ -37,6 +37,7 @@ define( 'WP_MAX_MEMORY_LIMIT', -1 ); $_SERVER['SERVER_PROTOCOL'] = 'HTTP/1.1'; $_SERVER['HTTP_HOST'] = WP_TESTS_DOMAIN; +$_SERVER['REQUEST_METHOD'] = 'GET'; $PHP_SELF = $GLOBALS['PHP_SELF'] = $_SERVER['PHP_SELF'] = '/index.php'; if ( "1" == getenv( 'WP_MULTISITE' ) || diff --git a/tests/phpunit/includes/install.php b/tests/phpunit/includes/install.php index 592e3808d6..d05bc4443f 100644 --- a/tests/phpunit/includes/install.php +++ b/tests/phpunit/includes/install.php @@ -15,6 +15,7 @@ require_once dirname( __FILE__ ) . '/functions.php'; $_SERVER['SERVER_PROTOCOL'] = 'HTTP/1.1'; $_SERVER['HTTP_HOST'] = WP_TESTS_DOMAIN; +$_SERVER['REQUEST_METHOD'] = 'GET'; $PHP_SELF = $GLOBALS['PHP_SELF'] = $_SERVER['PHP_SELF'] = '/index.php'; require_once ABSPATH . '/wp-settings.php'; diff --git a/tests/phpunit/tests/auth.php b/tests/phpunit/tests/auth.php index 8a3f6d9298..120d8fcbe1 100644 --- a/tests/phpunit/tests/auth.php +++ b/tests/phpunit/tests/auth.php @@ -10,8 +10,6 @@ class Tests_Auth extends WP_UnitTestCase { function setUp() { parent::setUp(); $this->user_id = $this->factory->user->create(); - - $_SERVER['REQUEST_METHOD'] = null; } function test_auth_cookie_valid() {