3 use MediaWiki\MainConfigNames
;
6 * Base class that store and restore the Language objects
8 abstract class MediaWikiLangTestCase
extends MediaWikiIntegrationTestCase
{
10 * The annotation causes this to be called immediately before setUp()
13 final protected function mediaWikiLangSetUp(): void
{
14 $services = $this->getServiceContainer();
15 $languageCode = $this->getConfVar( MainConfigNames
::LanguageCode
);
16 $contLanguageCode = $services->getContentLanguageCode()->toString();
17 if ( $languageCode !== $contLanguageCode ) {
18 throw new RuntimeException( "Error in " . __METHOD__
. ': ' .
19 "\$wgLanguageCode ('$languageCode') is different from content language code " .
20 "('$contLanguageCode')" );
23 $this->setUserLang( 'en' );
24 // For mainpage to be 'Main Page'
25 $this->setContentLang( 'en' );
27 $services->getMessageCache()->disable();