X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2FMediaWikiLangTestCase.php;h=53e672247e47e7c8af827803ef20c5d547e4c3b6;hb=1fb1fa4601b86588256bac743fa931c66b56206a;hp=3034601132b1e15aa60d08e7b48b66a1558791f7;hpb=4b3c86cc6ee79647c10dcbb90a1d11db03501931;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/MediaWikiLangTestCase.php b/tests/phpunit/MediaWikiLangTestCase.php index 3034601132..53e672247e 100644 --- a/tests/phpunit/MediaWikiLangTestCase.php +++ b/tests/phpunit/MediaWikiLangTestCase.php @@ -4,17 +4,20 @@ * Base class that store and restore the Language objects */ abstract class MediaWikiLangTestCase extends MediaWikiTestCase { - protected function setUp() { global $wgLanguageCode, $wgContLang; parent::setUp(); if ( $wgLanguageCode != $wgContLang->getCode() ) { - throw new MWException("Error in MediaWikiLangTestCase::setUp(): " . + throw new MWException( "Error in MediaWikiLangTestCase::setUp(): " . "\$wgLanguageCode ('$wgLanguageCode') is different from " . "\$wgContLang->getCode() (" . $wgContLang->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 );