X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dcompta/comptes/journal.php?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fcontent%2FCssContentTest.php;h=1e82fdd4d31e4b08ce8d6947bd9a85cb430121f4;hb=4de7b0a5424cb5d0a712eb177cfa35e170626714;hp=24b0c68227d63c875b140d76b31b4cffcb3eef7c;hpb=04fdc78370dbc042116488d6826e19bf3910273b;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/content/CssContentTest.php b/tests/phpunit/includes/content/CssContentTest.php index 24b0c68227..1e82fdd4d3 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,24 @@ class CssContentTest extends JavaScriptContentTest { * Redirects aren't supported */ public static function provideUpdateRedirect() { - return array( - array( + return [ + [ '#REDIRECT [[Someplace]]', '#REDIRECT [[Someplace]]', - ), - ); + ], + ]; } /** + * @covers CssContent::getRedirectTarget * @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 ); @@ -101,25 +102,25 @@ class CssContentTest extends JavaScriptContentTest { */ public static function provideGetRedirectTarget() { // @codingStandardsIgnoreStart Generic.Files.LineLength - 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);" ), + 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 ), - ); + 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 ], + ]; } /**