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