X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=tests%2Fphpunit%2FMediaWikiLangTestCase.php;h=4b0edb13f18d4f36afe3bbab10b8f1b0dc633c86;hp=214bcc11baf5e36b0a5cc8a59450c5700b8e6eb6;hb=733704ed8248f71dfb982d22799104a976d1ada4;hpb=58cb1f824ac75c3b58ba19d1e88c1b38f9dc1fab diff --git a/tests/phpunit/MediaWikiLangTestCase.php b/tests/phpunit/MediaWikiLangTestCase.php index 214bcc11ba..4b0edb13f1 100644 --- a/tests/phpunit/MediaWikiLangTestCase.php +++ b/tests/phpunit/MediaWikiLangTestCase.php @@ -1,31 +1,26 @@ getCode() ) { + $contLang = MediaWikiServices::getInstance()->getContentLanguage(); + if ( $wgLanguageCode != $contLang->getCode() ) { throw new MWException( "Error in MediaWikiLangTestCase::setUp(): " . - "\$wgLanguageCode ('$wgLanguageCode') is different from " . - "\$wgContLang->getCode() (" . $wgContLang->getCode() . ")" ); + "\$wgLanguageCode ('$wgLanguageCode') is different from content language code (" . + $contLang->getCode() . ")" ); } - // HACK: Call getLanguage() so the real $wgContLang is cached as the user language - // rather than our fake one. This is to avoid breaking other, unrelated tests. - RequestContext::getMain()->getLanguage(); - - $langCode = 'en'; # For mainpage to be 'Main Page' - $langObj = Language::factory( $langCode ); + parent::setUp(); - $this->setMwGlobals( [ - 'wgLanguageCode' => $langCode, - 'wgLang' => $langObj, - 'wgContLang' => $langObj, - ] ); + $this->setUserLang( 'en' ); + // For mainpage to be 'Main Page' + $this->setContentLang( 'en' ); MessageCache::singleton()->disable(); }