test: coverage recording now needs to be explicit
[mediawiki.git] / tests / phpunit / MediaWikiLangTestCase.php
blob1131385f6b944f745af792d28b8378a675b27206
1 <?php
3 /**
4 * Base class that store and restore the Language objects
5 */
6 abstract class MediaWikiLangTestCase extends MediaWikiTestCase {
8 protected function setUp() {
9 global $wgLanguageCode, $wgContLang;
10 parent::setUp();
12 if ( $wgLanguageCode != $wgContLang->getCode() ) {
13 throw new MWException( "Error in MediaWikiLangTestCase::setUp(): " .
14 "\$wgLanguageCode ('$wgLanguageCode') is different from " .
15 "\$wgContLang->getCode() (" . $wgContLang->getCode() . ")" );
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();
22 $langCode = 'en'; # For mainpage to be 'Main Page'
23 $langObj = Language::factory( $langCode );
25 $this->setMwGlobals( array(
26 'wgLanguageCode' => $langCode,
27 'wgLang' => $langObj,
28 'wgContLang' => $langObj,
29 ) );
31 MessageCache::singleton()->disable();