4 * Base class that store and restore the Language objects
6 abstract class MediaWikiLangTestCase
extends MediaWikiTestCase
{
7 protected function setUp() {
8 global $wgLanguageCode, $wgContLang;
11 if ( $wgLanguageCode != $wgContLang->getCode() ) {
12 throw new MWException( "Error in MediaWikiLangTestCase::setUp(): " .
13 "\$wgLanguageCode ('$wgLanguageCode') is different from " .
14 "\$wgContLang->getCode() (" . $wgContLang->getCode() . ")" );
17 // HACK: Call getLanguage() so the real $wgContLang is cached as the user language
18 // rather than our fake one. This is to avoid breaking other, unrelated tests.
19 RequestContext
::getMain()->getLanguage();
21 $langCode = 'en'; # For mainpage to be 'Main Page'
22 $langObj = Language
::factory( $langCode );
24 $this->setMwGlobals( array(
25 'wgLanguageCode' => $langCode,
27 'wgContLang' => $langObj,
30 MessageCache
::singleton()->disable();