blob: 53e672247e47e7c8af827803ef20c5d547e4c3b6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
<?php
/**
* Base class that store and restore the Language objects
*/
abstract class MediaWikiLangTestCase extends MediaWikiTestCase {
protected function setUp() {
global $wgLanguageCode, $wgContLang;
parent::setUp();
if ( $wgLanguageCode != $wgContLang->getCode() ) {
throw new MWException( "Error in MediaWikiLangTestCase::setUp(): " .
"\$wgLanguageCode ('$wgLanguageCode') is different from " .
"\$wgContLang->getCode() (" . $wgContLang->getCode() . ")" );
}
// HACK: Call getLanguage() so the real $wgContLang is cached as the user language
// rather than our fake one. This is to avoid breaking other, unrelated tests.
RequestContext::getMain()->getLanguage();
$langCode = 'en'; # For mainpage to be 'Main Page'
$langObj = Language::factory( $langCode );
$this->setMwGlobals( array(
'wgLanguageCode' => $langCode,
'wgLang' => $langObj,
'wgContLang' => $langObj,
) );
MessageCache::singleton()->disable();
}
}
|