Debian Codegraph @

tests/phpunit/MediaWikiLangTestCase.php

raw symbols SCIP
1 <?php
2
3 use MediaWiki\MainConfigNames;
4
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
12 */
13 final protected function mediaWikiLangSetUp(): void {
14 $services = $this->getServiceContainer();
15 $languageCode = $this->getConfVar( MainConfigNames::LanguageCode );
16 $contLanguageCode = $services->getContentLanguage()->getCode();
17 if ( $languageCode !== $contLanguageCode ) {
18 throw new RuntimeException( "Error in " . __METHOD__ . ': ' .
19 "\$wgLanguageCode ('$languageCode') is different from content language code " .
20 "('$contLanguageCode')" );
21 }
22
23 $this->setUserLang( 'en' );
24 // For mainpage to be 'Main Page'
25 $this->setContentLang( 'en' );
26
27 $services->getMessageCache()->disable();
28 }
29 }