From d0f17d8a97459a4fb61574523877777f18b4573d Mon Sep 17 00:00:00 2001 From: "This, that and the other" Date: Wed, 1 Feb 2017 00:54:35 +1100 Subject: [PATCH] Merge duplicate SpecialSearchTest files Change-Id: I1d6be3f6c32102ee8c7f4ee3dc6f0c752ef05534 --- .../includes/specials/SpecialSearchTest.php | 21 +++++++++++++++++ tests/phpunit/specials/SpecialSearchTest.php | 23 ------------------- 2 files changed, 21 insertions(+), 23 deletions(-) delete mode 100644 tests/phpunit/specials/SpecialSearchTest.php diff --git a/tests/phpunit/includes/specials/SpecialSearchTest.php b/tests/phpunit/includes/specials/SpecialSearchTest.php index e9cf6a3516..13c21c01b7 100644 --- a/tests/phpunit/includes/specials/SpecialSearchTest.php +++ b/tests/phpunit/includes/specials/SpecialSearchTest.php @@ -205,6 +205,27 @@ class SpecialSearchTest extends MediaWikiTestCase { return $mock; } + + public function testSubPageRedirect() { + $this->setMwGlobals( [ + 'wgScript' => '/w/index.php', + ] ); + + $ctx = new RequestContext; + $sp = Title::newFromText( 'Special:Search/foo_bar' ); + SpecialPageFactory::executePath( $sp, $ctx ); + $url = $ctx->getOutput()->getRedirect(); + // some older versions of hhvm have a bug that doesn't parse relative + // urls with a port, so help it out a little bit. + // https://github.com/facebook/hhvm/issues/7136 + $url = wfExpandUrl( $url, PROTO_CURRENT ); + + $parts = parse_url( $url ); + $this->assertEquals( '/w/index.php', $parts['path'] ); + parse_str( $parts['query'], $query ); + $this->assertEquals( 'Special:Search', $query['title'] ); + $this->assertEquals( 'foo bar', $query['search'] ); + } } class SpecialSearchTestMockResultSet extends SearchResultSet { diff --git a/tests/phpunit/specials/SpecialSearchTest.php b/tests/phpunit/specials/SpecialSearchTest.php deleted file mode 100644 index 20e88f5a5b..0000000000 --- a/tests/phpunit/specials/SpecialSearchTest.php +++ /dev/null @@ -1,23 +0,0 @@ -getOutput()->getRedirect(); - // some older versions of hhvm have a bug that doesn't parse relative - // urls with a port, so help it out a little bit. - // https://github.com/facebook/hhvm/issues/7136 - $url = wfExpandUrl( $url, PROTO_CURRENT ); - - $parts = parse_url( $url ); - $this->assertEquals( '/w/index.php', $parts['path'] ); - parse_str( $parts['query'], $query ); - $this->assertEquals( 'Special:Search', $query['title'] ); - $this->assertEquals( 'foo bar', $query['search'] ); - } -} -- 2.20.1