3 class SpecialSearchText
extends \PHPUnit_Framework_TestCase
{
4 public function testSubPageRedirect() {
5 $ctx = new RequestContext
;
7 SpecialPageFactory
::executePath(
8 Title
::newFromText( 'Special:Search/foo_bar' ),
11 $url = $ctx->getOutput()->getRedirect();
12 // some older versions of hhvm have a bug that doesn't parse relative
13 // urls with a port, so help it out a little bit.
14 // https://github.com/facebook/hhvm/issues/7136
15 $url = wfExpandUrl( $url, PROTO_CURRENT
);
17 $parts = parse_url( $url );
18 $this->assertEquals( '/w/index.php', $parts['path'] );
19 parse_str( $parts['query'], $query );
20 $this->assertEquals( 'Special:Search', $query['title'] );
21 $this->assertEquals( 'foo bar', $query['search'] );