Localisation updates from https://translatewiki.net.
[mediawiki.git] / tests / phpunit / MediaWikiLangTestCase.php
blobcc8948f18159eb08bd5417360f0b148fe8a244ac
1 <?php
3 use MediaWiki\MainConfigNames;
5 /**
6 * Base class that store and restore the Language objects
7 */
8 abstract class MediaWikiLangTestCase extends MediaWikiIntegrationTestCase {
9 /**
10 * The annotation causes this to be called immediately before setUp()
11 * @before
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();