wiki.techinc.nl/tests/phpunit/MediaWikiLangTestCase.php

31 lines
851 B
PHP
Raw Normal View History

<?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() . ")" );
}
2011-05-10 19:15:09 +00:00
$this->setUserLang( 'en' );
// For mainpage to be 'Main Page'
$this->setContentLang( 'en' );
2011-05-10 19:15:09 +00:00
$services->getMessageCache()->disable();
}
}