wiki.techinc.nl/tests/phpunit/MediaWikiLangTestCase.php
libraryupgrader 5357695270 build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 36.0.0 → 37.0.0
  The following sniffs now pass and were enabled:
  * Generic.ControlStructures.InlineControlStructure
  * MediaWiki.PHPUnit.AssertCount.NotUsed

npm:
* svgo: 2.3.0 → 2.3.1
  * https://npmjs.com/advisories/1754 (CVE-2021-33587)

Change-Id: I2a9bbee2fecbf7259876d335f565ece4b3622426
2021-07-22 03:36:05 +00:00

30 lines
850 B
PHP

<?php
use MediaWiki\MediaWikiServices;
/**
* Base class that store and restore the Language objects
*/
abstract class MediaWikiLangTestCase extends MediaWikiIntegrationTestCase {
/**
* The annotation causes this to be called immediately before setUp()
* @before
*/
final protected function mediaWikiLangSetUp(): void {
global $wgLanguageCode;
$services = MediaWikiServices::getInstance();
$contLang = $services->getContentLanguage();
if ( $wgLanguageCode != $contLang->getCode() ) {
throw new MWException( "Error in MediaWikiLangTestCase::setUp(): " .
"\$wgLanguageCode ('$wgLanguageCode') is different from content language code (" .
$contLang->getCode() . ")" );
}
$this->setUserLang( 'en' );
// For mainpage to be 'Main Page'
$this->setContentLang( 'en' );
$services->getMessageCache()->disable();
}
}