3 class JavaScriptContentHandlerTest
extends MediaWikiLangTestCase
{
6 * @dataProvider provideMakeRedirectContent
7 * @covers JavaScriptContentHandler::makeRedirectContent
9 public function testMakeRedirectContent( $title, $expected ) {
10 $this->setMwGlobals( [
11 'wgServer' => '//example.org',
12 'wgScript' => '/w/index.php',
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
) );
21 * Keep this in sync with JavaScriptContentTest::provideGetRedirectTarget()
23 public static function provideMakeRedirectContent() {
24 // @codingStandardsIgnoreStart Generic.Files.LineLength
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");'
36 '/* #REDIRECT */mw.loader.load("//example.org/w/index.php?title=Gadget:FooBaz.js\u0026action=raw\u0026ctype=text/javascript");'
39 // @codingStandardsIgnoreEnd