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