X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fcontent%2FJavaScriptContentTest.php;h=6656fa4d76fe2a122899515ba09c6394e769a17d;hb=ca5aacd6c11df2403d672deec99f53e9cbdd1fd7;hp=abe352a12f453393a114884b0afe2cea636e0af8;hpb=6e9b4f0e9ce4ccd6089c18b205065ef7fa077484;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/content/JavaScriptContentTest.php b/tests/phpunit/includes/content/JavaScriptContentTest.php index abe352a12f..6656fa4d76 100644 --- a/tests/phpunit/includes/content/JavaScriptContentTest.php +++ b/tests/phpunit/includes/content/JavaScriptContentTest.php @@ -141,26 +141,6 @@ class JavaScriptContentTest extends TextContentTest { ]; } - /** - * @todo Test needs database! - */ - /* - public function getRedirectChain() { - $text = $this->getNativeData(); - return Title::newFromRedirectArray( $text ); - } - */ - - /** - * @todo Test needs database! - */ - /* - public function getUltimateRedirectTarget() { - $text = $this->getNativeData(); - return Title::newFromRedirectRecurse( $text ); - } - */ - public static function dataIsCountable() { return [ [ '', @@ -271,19 +251,18 @@ class JavaScriptContentTest extends TextContentTest { } public static function provideUpdateRedirect() { + // phpcs:disable Generic.Files.LineLength return [ [ '#REDIRECT [[Someplace]]', '#REDIRECT [[Someplace]]', ], - - // @codingStandardsIgnoreStart Generic.Files.LineLength - array( + [ '/* #REDIRECT */mw.loader.load("//example.org/w/index.php?title=MediaWiki:MonoBook.js\u0026action=raw\u0026ctype=text/javascript");', '/* #REDIRECT */mw.loader.load("//example.org/w/index.php?title=TestUpdateRedirect_target\u0026action=raw\u0026ctype=text/javascript");' - ) - // @codingStandardsIgnoreEnd + ] ]; + // phpcs:enable } /** @@ -314,6 +293,7 @@ class JavaScriptContentTest extends TextContentTest { } /** + * @covers JavaScriptContent::getRedirectTarget * @dataProvider provideGetRedirectTarget */ public function testGetRedirectTarget( $title, $text ) { @@ -332,16 +312,31 @@ class JavaScriptContentTest extends TextContentTest { * Keep this in sync with JavaScriptContentHandlerTest::provideMakeRedirectContent() */ public static function provideGetRedirectTarget() { - // @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");' ), + // phpcs:disable Generic.Files.LineLength + return [ + [ + 'MediaWiki:MonoBook.js', + '/* #REDIRECT */mw.loader.load("//example.org/w/index.php?title=MediaWiki:MonoBook.js\u0026action=raw\u0026ctype=text/javascript");' + ], + [ + 'User:FooBar/common.js', + '/* #REDIRECT */mw.loader.load("//example.org/w/index.php?title=User:FooBar/common.js\u0026action=raw\u0026ctype=text/javascript");' + ], + [ + 'Gadget:FooBaz.js', + '/* #REDIRECT */mw.loader.load("//example.org/w/index.php?title=Gadget:FooBaz.js\u0026action=raw\u0026ctype=text/javascript");' + ], // No #REDIRECT comment - array( null, 'mw.loader.load("//example.org/w/index.php?title=MediaWiki:NoRedirect.js\u0026action=raw\u0026ctype=text/javascript");' ), + [ + null, + 'mw.loader.load("//example.org/w/index.php?title=MediaWiki:NoRedirect.js\u0026action=raw\u0026ctype=text/javascript");' + ], // Different domain - array( null, '/* #REDIRECT */mw.loader.load("//example.com/w/index.php?title=MediaWiki:OtherWiki.js\u0026action=raw\u0026ctype=text/javascript");' ), - ); - // @codingStandardsIgnoreEnd + [ + null, + '/* #REDIRECT */mw.loader.load("//example.com/w/index.php?title=MediaWiki:OtherWiki.js\u0026action=raw\u0026ctype=text/javascript");' + ], + ]; + // phpcs:enable } }