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