rdbms: Rename "memCache" to "memStash" in LBFactory
[mediawiki.git] / tests / phpunit / includes / content / JavaScriptContentHandlerTest.php
blobd229623980b2d09d4773fcf9bc4018b328c1f217
1 <?php
3 class JavaScriptContentHandlerTest extends MediaWikiLangTestCase {
5 /**
6 * @dataProvider provideMakeRedirectContent
7 * @covers JavaScriptContentHandler::makeRedirectContent
8 */
9 public function testMakeRedirectContent( $title, $expected ) {
10 $this->setMwGlobals( [
11 'wgServer' => '//example.org',
12 'wgScript' => '/w/index.php',
13 ] );
14 $ch = new JavaScriptContentHandler();
15 $content = $ch->makeRedirectContent( Title::newFromText( $title ) );
16 $this->assertInstanceOf( 'JavaScriptContent', $content );
17 $this->assertEquals( $expected, $content->serialize( CONTENT_FORMAT_JAVASCRIPT ) );
20 /**
21 * Keep this in sync with JavaScriptContentTest::provideGetRedirectTarget()
23 public static function provideMakeRedirectContent() {
24 // @codingStandardsIgnoreStart Generic.Files.LineLength
25 return [
27 'MediaWiki:MonoBook.js',
28 '/* #REDIRECT */mw.loader.load("//example.org/w/index.php?title=MediaWiki:MonoBook.js\u0026action=raw\u0026ctype=text/javascript");'
31 'User:FooBar/common.js',
32 '/* #REDIRECT */mw.loader.load("//example.org/w/index.php?title=User:FooBar/common.js\u0026action=raw\u0026ctype=text/javascript");'
35 'Gadget:FooBaz.js',
36 '/* #REDIRECT */mw.loader.load("//example.org/w/index.php?title=Gadget:FooBaz.js\u0026action=raw\u0026ctype=text/javascript");'
39 // @codingStandardsIgnoreEnd