Set functions to final. This avoids that the function is overwritten without parent call Follows-up I9d4771c28160356ff58. Change-Id: I40cde489a892b06284692ecbbef14e650afe7c9e
30 lines
851 B
PHP
30 lines
851 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();
|
|
}
|
|
}
|