Merge duplicate SpecialSearchTest files
authorThis, that and the other <at.light@live.com.au>
Tue, 31 Jan 2017 13:54:35 +0000 (00:54 +1100)
committerThis, that and the other <at.light@live.com.au>
Tue, 31 Jan 2017 13:54:35 +0000 (00:54 +1100)
Change-Id: I1d6be3f6c32102ee8c7f4ee3dc6f0c752ef05534

tests/phpunit/includes/specials/SpecialSearchTest.php
tests/phpunit/specials/SpecialSearchTest.php [deleted file]

index e9cf6a3..13c21c0 100644 (file)
@@ -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 (file)
index 20e88f5..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-<?php
-
-class SpecialSearchText extends \PHPUnit_Framework_TestCase {
-       public function testSubPageRedirect() {
-               $ctx = new RequestContext;
-
-               SpecialPageFactory::executePath(
-                       Title::newFromText( 'Special:Search/foo_bar' ),
-                       $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'] );
-       }
-}