wiki.techinc.nl/tests/phpunit/MediaWikiLangTestCase.php
Kevin Israel 47d1060398 Remove is_numeric check from Title::checkUserBlock
This should allow the usernames of administrators such as "7"
to show correctly on permissions error pages.

I extracted the working code from UserBlockedError::__construct
into a separate method Block::getPermissionsError, called from
both places with context provided as an argument.

Additional changes to get the test suite to pass are included.

Bug: 46768
Change-Id: I49d973992a99e03b4e8de112b47b737037a85338
2013-04-24 01:05:23 +00:00

33 lines
969 B
PHP

<?php
/**
* Base class that store and restore the Language objects
*/
abstract class MediaWikiLangTestCase extends MediaWikiTestCase {
protected function setUp() {
global $wgLanguageCode, $wgContLang;
parent::setUp();
if ( $wgLanguageCode != $wgContLang->getCode() ) {
throw new MWException( "Error in MediaWikiLangTestCase::setUp(): " .
"\$wgLanguageCode ('$wgLanguageCode') is different from " .
"\$wgContLang->getCode() (" . $wgContLang->getCode() . ")" );
}
// HACK: Call getLanguage() so the real $wgContLang is cached as the user language
// rather than our fake one. This is to avoid breaking other, unrelated tests.
RequestContext::getMain()->getLanguage();
$langCode = 'en'; # For mainpage to be 'Main Page'
$langObj = Language::factory( $langCode );
$this->setMwGlobals( array(
'wgLanguageCode' => $langCode,
'wgLang' => $langObj,
'wgContLang' => $langObj,
) );
MessageCache::singleton()->disable();
}
}