MediaWiki
REL1_22
|
00001 <?php 00002 00006 abstract class MediaWikiLangTestCase extends MediaWikiTestCase { 00007 00008 protected function setUp() { 00009 global $wgLanguageCode, $wgContLang; 00010 parent::setUp(); 00011 00012 if ( $wgLanguageCode != $wgContLang->getCode() ) { 00013 throw new MWException( "Error in MediaWikiLangTestCase::setUp(): " . 00014 "\$wgLanguageCode ('$wgLanguageCode') is different from " . 00015 "\$wgContLang->getCode() (" . $wgContLang->getCode() . ")" ); 00016 } 00017 00018 // HACK: Call getLanguage() so the real $wgContLang is cached as the user language 00019 // rather than our fake one. This is to avoid breaking other, unrelated tests. 00020 RequestContext::getMain()->getLanguage(); 00021 00022 $langCode = 'en'; # For mainpage to be 'Main Page' 00023 $langObj = Language::factory( $langCode ); 00024 00025 $this->setMwGlobals( array( 00026 'wgLanguageCode' => $langCode, 00027 'wgLang' => $langObj, 00028 'wgContLang' => $langObj, 00029 ) ); 00030 00031 MessageCache::singleton()->disable(); 00032 } 00033 }