X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fcontent%2FCssContentTest.php;h=d2078d7a23c293384a8ea81260c74ad260c0db1c;hb=b6db0c81433dd9cffffc77eae5ce83d29ebbf8a2;hp=c4d87c24f7b2d164ddfffff96ffd4bcdcada9199;hpb=7b0df4e54913bcebb312279642e9bc19a6d366d5;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/content/CssContentTest.php b/tests/phpunit/includes/content/CssContentTest.php index c4d87c24f7..d2078d7a23 100644 --- a/tests/phpunit/includes/content/CssContentTest.php +++ b/tests/phpunit/includes/content/CssContentTest.php @@ -16,12 +16,12 @@ class CssContentTest extends JavaScriptContentTest { $user = new User(); $user->setName( '127.0.0.1' ); - $this->setMwGlobals( array( + $this->setMwGlobals( [ 'wgUser' => $user, - 'wgTextModelsToParse' => array( + 'wgTextModelsToParse' => [ CONTENT_MODEL_CSS, - ) - ) ); + ] + ] ); } public function newContent( $text ) { @@ -29,27 +29,27 @@ class CssContentTest extends JavaScriptContentTest { } public static function dataGetParserOutput() { - return array( - array( + return [ + [ 'MediaWiki:Test.css', null, "hello \n", "
\nhello <world>\n\n
" - ), - array( + ], + [ 'MediaWiki:Test.css', null, "/* hello [[world]] */\n", "
\n/* hello [[world]] */\n\n
", - array( - 'Links' => array( - array( 'World' => 0 ) - ) - ) - ), + [ + 'Links' => [ + [ 'World' => 0 ] + ] + ] + ], // TODO: more...? - ); + ]; } /** @@ -74,23 +74,23 @@ class CssContentTest extends JavaScriptContentTest { * Redirects aren't supported */ public static function provideUpdateRedirect() { - return array( - array( + return [ + [ '#REDIRECT [[Someplace]]', '#REDIRECT [[Someplace]]', - ), - ); + ], + ]; } /** * @dataProvider provideGetRedirectTarget */ public function testGetRedirectTarget( $title, $text ) { - $this->setMwGlobals( array( + $this->setMwGlobals( [ 'wgServer' => '//example.org', 'wgScriptPath' => '/w', 'wgScript' => '/w/index.php', - ) ); + ] ); $content = new CssContent( $text ); $target = $content->getRedirectTarget(); $this->assertEquals( $title, $target ? $target->getPrefixedText() : null ); @@ -100,24 +100,26 @@ class CssContentTest extends JavaScriptContentTest { * Keep this in sync with CssContentHandlerTest::provideMakeRedirectContent() */ public static function provideGetRedirectTarget() { - return array( - array( 'MediaWiki:MonoBook.css', "/* #REDIRECT */@import url(//example.org/w/index.php?title=MediaWiki:MonoBook.css&action=raw&ctype=text/css);" ), - array( 'User:FooBar/common.css', "/* #REDIRECT */@import url(//example.org/w/index.php?title=User:FooBar/common.css&action=raw&ctype=text/css);" ), - array( 'Gadget:FooBaz.css', "/* #REDIRECT */@import url(//example.org/w/index.php?title=Gadget:FooBaz.css&action=raw&ctype=text/css);" ), + // @codingStandardsIgnoreStart Generic.Files.LineLength + return [ + [ 'MediaWiki:MonoBook.css', "/* #REDIRECT */@import url(//example.org/w/index.php?title=MediaWiki:MonoBook.css&action=raw&ctype=text/css);" ], + [ 'User:FooBar/common.css', "/* #REDIRECT */@import url(//example.org/w/index.php?title=User:FooBar/common.css&action=raw&ctype=text/css);" ], + [ 'Gadget:FooBaz.css', "/* #REDIRECT */@import url(//example.org/w/index.php?title=Gadget:FooBaz.css&action=raw&ctype=text/css);" ], # No #REDIRECT comment - array( null, "@import url(//example.org/w/index.php?title=Gadget:FooBaz.css&action=raw&ctype=text/css);" ), + [ null, "@import url(//example.org/w/index.php?title=Gadget:FooBaz.css&action=raw&ctype=text/css);" ], # Wrong domain - array( null, "/* #REDIRECT */@import url(//example.com/w/index.php?title=Gadget:FooBaz.css&action=raw&ctype=text/css);" ), - ); + [ null, "/* #REDIRECT */@import url(//example.com/w/index.php?title=Gadget:FooBaz.css&action=raw&ctype=text/css);" ], + ]; + // @codingStandardsIgnoreEnd } - public static function dataEquals() { - return array( - array( new CssContent( 'hallo' ), null, false ), - array( new CssContent( 'hallo' ), new CssContent( 'hallo' ), true ), - array( new CssContent( 'hallo' ), new WikitextContent( 'hallo' ), false ), - array( new CssContent( 'hallo' ), new CssContent( 'HALLO' ), false ), - ); + public static function dataEquals() { + return [ + [ new CssContent( 'hallo' ), null, false ], + [ new CssContent( 'hallo' ), new CssContent( 'hallo' ), true ], + [ new CssContent( 'hallo' ), new WikitextContent( 'hallo' ), false ], + [ new CssContent( 'hallo' ), new CssContent( 'HALLO' ), false ], + ]; } /**