* Base class that store and restore the Language objects
*/
abstract class MediaWikiLangTestCase extends MediaWikiTestCase {
- private static $oldLang;
- private static $oldContLang;
+ protected function setUp() {
+ global $wgLanguageCode, $wgContLang;
- public function setUp() {
- global $wgLanguageCode, $wgLang, $wgContLang;
-
- parent::setUp();
-
- self::$oldLang = $wgLang;
- self::$oldContLang = $wgContLang;
-
- if( $wgLanguageCode != $wgContLang->getCode() ) {
- throw new MWException("Error in MediaWikiLangTestCase::setUp(): " .
+ if ( $wgLanguageCode != $wgContLang->getCode() ) {
+ throw new MWException( "Error in MediaWikiLangTestCase::setUp(): " .
"\$wgLanguageCode ('$wgLanguageCode') is different from " .
"\$wgContLang->getCode() (" . $wgContLang->getCode() . ")" );
}
- $wgLanguageCode = 'en'; # For mainpage to be 'Main Page'
-
- $wgContLang = $wgLang = Language::factory( $wgLanguageCode );
- MessageCache::singleton()->disable();
-
- }
-
- public function tearDown() {
- global $wgContLang, $wgLang, $wgLanguageCode;
- $wgLang = self::$oldLang;
+ parent::setUp();
- $wgContLang = self::$oldContLang;
- $wgLanguageCode = $wgContLang->getCode();
- self::$oldContLang = self::$oldLang = null;
+ $this->setUserLang( 'en' );
+ // For mainpage to be 'Main Page'
+ $this->setContentLang( 'en' );
- parent::tearDown();
+ MessageCache::singleton()->disable();
}
-
}