wiki.techinc.nl/tests/phpunit/includes/content/JavaScriptContentHandlerTest.php
Amir E. Aharoni e77af93e83 Add @codingStandardsIgnoreStart to 5 files under tests/phpunit/includes
To pass phpcs.

Bug: T102614
Change-Id: I4c7d60d26112c7ba67b66f1923ce945e96175d15
2015-10-03 12:30:29 +00:00

32 lines
1.3 KiB
PHP

<?php
class JavaScriptContentHandlerTest extends MediaWikiTestCase {
/**
* @dataProvider provideMakeRedirectContent
* @covers JavaScriptContentHandler::makeRedirectContent
*/
public function testMakeRedirectContent( $title, $expected ) {
$this->setMwGlobals( array(
'wgServer' => '//example.org',
'wgScript' => '/w/index.php',
) );
$ch = new JavaScriptContentHandler();
$content = $ch->makeRedirectContent( Title::newFromText( $title ) );
$this->assertInstanceOf( 'JavaScriptContent', $content );
$this->assertEquals( $expected, $content->serialize( CONTENT_FORMAT_JAVASCRIPT ) );
}
/**
* Keep this in sync with JavaScriptContentTest::provideGetRedirectTarget()
*/
public static function provideMakeRedirectContent() {
// @codingStandardsIgnoreStart Generic.Files.LineLength
return array(
array( 'MediaWiki:MonoBook.js', '/* #REDIRECT */mw.loader.load("//example.org/w/index.php?title=MediaWiki:MonoBook.js\u0026action=raw\u0026ctype=text/javascript");' ),
array( 'User:FooBar/common.js', '/* #REDIRECT */mw.loader.load("//example.org/w/index.php?title=User:FooBar/common.js\u0026action=raw\u0026ctype=text/javascript");' ),
array( 'Gadget:FooBaz.js', '/* #REDIRECT */mw.loader.load("//example.org/w/index.php?title=Gadget:FooBaz.js\u0026action=raw\u0026ctype=text/javascript");' ),
);
// @codingStandardsIgnoreEnd
}
}