wiki.techinc.nl/tests/phpunit/MediaWikiLangTestCase.php
Max Semenik 48a323f702 tests: Add explicit return type void to setUp() and tearDown()
Bug: T192167
Depends-On: I581e54278ac5da3f4e399e33f2c7ad468bae6b43
Change-Id: I3a21fb55db76bac51afdd399cf40ed0760e4f343
2019-10-30 14:31:22 -07:00

27 lines
720 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;
$contLang = MediaWikiServices::getInstance()->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' );
MessageCache::singleton()->disable();
}
}