wiki.techinc.nl/tests/phpunit/MediaWikiLangTestCase.php
Umherirrender 3161311c5a Use MediaWikiServices::getMessageCache
Change-Id: I07fcc9529991adc634c10e5ed8498ac138a1c2b7
2020-03-14 14:25:03 +01:00

28 lines
748 B
PHP

<?php
use MediaWiki\MediaWikiServices;
/**
* Base class that store and restore the Language objects
*/
abstract class MediaWikiLangTestCase extends MediaWikiTestCase {
protected function setUp() : 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() . ")" );
}
parent::setUp();
$this->setUserLang( 'en' );
// For mainpage to be 'Main Page'
$this->setContentLang( 'en' );
$services->getMessageCache()->disable();
}
}