Ensure that a request URL is always set in WP_UnitTestCase::go_to().

Failure to set this variable meant that passing the home URL to `go_to()`
(without a trailing slash) resulted in a PHP notice, and failed to reset the
globals properly.

Props joostdevalk.
Fixes #31417.

git-svn-id: https://develop.svn.wordpress.org/trunk@31515 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Boone Gorges
2015-02-23 01:07:18 +00:00
parent e61b0021bd
commit 129e5f5278
2 changed files with 11 additions and 1 deletions

View File

@@ -333,7 +333,7 @@ class WP_UnitTestCase extends PHPUnit_Framework_TestCase {
}
$parts = parse_url($url);
if (isset($parts['scheme'])) {
$req = $parts['path'];
$req = isset( $parts['path'] ) ? $parts['path'] : '';
if (isset($parts['query'])) {
$req .= '?' . $parts['query'];
// parse the url query vars into $_GET