diff --git a/tests/phpunit/includes/testcase.php b/tests/phpunit/includes/testcase.php index dc888740f6..81f9686050 100644 --- a/tests/phpunit/includes/testcase.php +++ b/tests/phpunit/includes/testcase.php @@ -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 diff --git a/tests/phpunit/tests/includes/helpers.php b/tests/phpunit/tests/includes/helpers.php index 025b9384f6..b717fdcb1a 100755 --- a/tests/phpunit/tests/includes/helpers.php +++ b/tests/phpunit/tests/includes/helpers.php @@ -185,6 +185,16 @@ class Tests_TestHelpers extends WP_UnitTestCase { $this->mock_incorrect_usage(); } + /** + * @ticket 31417 + */ + public function test_go_to_should_go_to_home_page_when_passing_the_untrailingslashed_home_url() { + $this->assertFalse( is_home() ); + $home = untrailingslashit( get_option( 'home' ) ); + $this->go_to( $home ); + $this->assertTrue( is_home() ); + } + protected function mock_deprecated() { _deprecated_function( __METHOD__, '2.5' ); }