MediaWiki  REL1_19
MediaWikiLangTestCase.php
Go to the documentation of this file.
00001 <?php
00002 
00006 abstract class MediaWikiLangTestCase extends MediaWikiTestCase {
00007         private static $oldLang;
00008         private static $oldContLang;
00009 
00010         public function setUp() {
00011                 global $wgLanguageCode, $wgLang, $wgContLang;
00012 
00013                 self::$oldLang = $wgLang;
00014                 self::$oldContLang = $wgContLang;
00015 
00016                 if( $wgLanguageCode != $wgContLang->getCode() ) {
00017                         throw new MWException("Error in MediaWikiLangTestCase::setUp(): " .
00018                                 "\$wgLanguageCode ('$wgLanguageCode') is different from " .
00019                                 "\$wgContLang->getCode() (" . $wgContLang->getCode() . ")" );
00020                 }
00021 
00022                 $wgLanguageCode = 'en'; # For mainpage to be 'Main Page'
00023 
00024                 $wgContLang = $wgLang = Language::factory( $wgLanguageCode );
00025                 MessageCache::singleton()->disable();
00026         }
00027 
00028         public function tearDown() {
00029                 global $wgContLang, $wgLang, $wgLanguageCode;
00030                 $wgLang = self::$oldLang;
00031 
00032                 $wgContLang = self::$oldContLang;
00033                 $wgLanguageCode = $wgContLang->getCode();
00034                 self::$oldContLang = self::$oldLang = null;
00035         }
00036 
00037 }