MediaWiki  1.23.15
MediaWikiLangTestCase.php
Go to the documentation of this file.
1 <?php
2 
6 abstract class MediaWikiLangTestCase extends MediaWikiTestCase {
7 
8  protected function setUp() {
9  global $wgLanguageCode, $wgContLang;
10  parent::setUp();
11 
12  if ( $wgLanguageCode != $wgContLang->getCode() ) {
13  throw new MWException( "Error in MediaWikiLangTestCase::setUp(): " .
14  "\$wgLanguageCode ('$wgLanguageCode') is different from " .
15  "\$wgContLang->getCode() (" . $wgContLang->getCode() . ")" );
16  }
17 
18  // HACK: Call getLanguage() so the real $wgContLang is cached as the user language
19  // rather than our fake one. This is to avoid breaking other, unrelated tests.
20  RequestContext::getMain()->getLanguage();
21 
22  $langCode = 'en'; # For mainpage to be 'Main Page'
23  $langObj = Language::factory( $langCode );
24 
25  $this->setMwGlobals( array(
26  'wgLanguageCode' => $langCode,
27  'wgLang' => $langObj,
28  'wgContLang' => $langObj,
29  ) );
30 
31  MessageCache::singleton()->disable();
32  }
33 }
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
$wgContLang
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the content language as $wgContLang
Definition: design.txt:56
MWException
MediaWiki exception.
Definition: MWException.php:26
MediaWikiTestCase\setMwGlobals
setMwGlobals( $pairs, $value=null)
Definition: MediaWikiTestCase.php:302
MediaWikiTestCase
Definition: MediaWikiTestCase.php:6
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
MessageCache\singleton
static singleton()
Get the signleton instance of this class.
Definition: MessageCache.php:101
MediaWikiLangTestCase\setUp
setUp()
Definition: MediaWikiLangTestCase.php:8
MediaWikiLangTestCase
Base class that store and restore the Language objects.
Definition: MediaWikiLangTestCase.php:6
RequestContext\getMain
static getMain()
Static methods.
Definition: RequestContext.php:420
Language\factory
static factory( $code)
Get a cached or new language object for a given language code.
Definition: Language.php:184