Merge "Change space to non-breaking space to keep headers aligned"
[lhc/web/wiklou.git] / tests / phpunit / MediaWikiLangTestCase.php
1 <?php
2
3 /**
4 * Base class that store and restore the Language objects
5 */
6 abstract class MediaWikiLangTestCase extends MediaWikiTestCase {
7
8 protected function setUp() {
9 global $wgLanguageCode, $wgContLang;
10 parent::setUp();
11
12 if ( $wgLanguageCode != $wgContLang->getCode() ) {
13 throw new MWException( "Error in MediaWikiLangTestCase::setUp(): " .
14 "\$wgLanguageCode ('$wgLanguageCode') is different from " .
15 "\$wgContLang->getCode() (" . $wgContLang->getCode() . ")" );
16 }
17
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();
21
22 $langCode = 'en'; # For mainpage to be 'Main Page'
23 $langObj = Language::factory( $langCode );
24
25 $this->setMwGlobals( array(
26 'wgLanguageCode' => $langCode,
27 'wgLang' => $langObj,
28 'wgContLang' => $langObj,
29 ) );
30
31 MessageCache::singleton()->disable();
32 }
33 }