X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2FExtraParserTest.php;h=5dd4f7a07c019e30a49c38130fb24c720b30b11c;hb=8b18ae7b5;hp=77b26b3bd4a60bde9922c1bc199567675f140a1e;hpb=4fa02402289e9ba08369f2c3f9cb78eb0080027a;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/ExtraParserTest.php b/tests/phpunit/includes/ExtraParserTest.php index 77b26b3bd4..5dd4f7a07c 100644 --- a/tests/phpunit/includes/ExtraParserTest.php +++ b/tests/phpunit/includes/ExtraParserTest.php @@ -16,18 +16,16 @@ class ExtraParserTest extends MediaWikiTestCase { parent::setUp(); $contLang = Language::factory( 'en' ); - $this->setMwGlobals( array( + $this->setMwGlobals( [ 'wgShowDBErrorBacktrace' => true, - 'wgLanguageCode' => 'en', - 'wgContLang' => $contLang, - 'wgLang' => Language::factory( 'en' ), - 'wgMemc' => new EmptyBagOStuff, - 'wgAlwaysUseTidy' => false, 'wgCleanSignatures' => true, - ) ); + ] ); + $this->setUserLang( 'en' ); + $this->setContentLang( $contLang ); + // FIXME: This test should pass without setting global content language $this->options = ParserOptions::newFromUserAndLang( new User, $contLang ); - $this->options->setTemplateCallback( array( __CLASS__, 'statelessFetchTemplate' ) ); + $this->options->setTemplateCallback( [ __CLASS__, 'statelessFetchTemplate' ] ); $this->parser = new Parser; MagicWord::clearCache(); @@ -121,11 +119,11 @@ class ExtraParserTest extends MediaWikiTestCase { } public static function provideStringsForCleanSigInSig() { - return array( - array( "{{Foo}} ~~~~", "{{Foo}} " ), - array( "~~~", "" ), - array( "~~~~~", "" ), - ); + return [ + [ "{{Foo}} ~~~~", "{{Foo}} " ], + [ "~~~", "" ], + [ "~~~~~", "" ], + ]; } /** @@ -184,12 +182,12 @@ class ExtraParserTest extends MediaWikiTestCase { */ static function statelessFetchTemplate( $title, $parser = false ) { $text = "Content of ''" . $title->getFullText() . "''"; - $deps = array(); + $deps = []; - return array( + return [ 'text' => $text, 'finalTitle' => $title, - 'deps' => $deps ); + 'deps' => $deps ]; } /** @@ -200,7 +198,7 @@ class ExtraParserTest extends MediaWikiTestCase { $title = Title::newFromText( __FUNCTION__ ); $catName = wfMessage( 'broken-file-category' )->inContentLanguage()->text(); $cat = Title::makeTitleSafe( NS_CATEGORY, $catName ); - $expected = array( $cat->getDBkey() ); + $expected = [ $cat->getDBkey() ]; $parserOutput = $this->parser->parse( "[[file:nonexistent]]", $title, $this->options ); $result = $parserOutput->getCategoryLinks(); $this->assertEquals( $expected, $result );