X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2FMediaWikiLangTestCase.php;h=fd308b2d9584697045edbf1ae2a46dec617b69c6;hb=456729e8d2a95f5e5cbfdec8816996cacd56c890;hp=6dd8ea35c2496a38d8c73543572f1e755265365a;hpb=4878e9593c313e0ab6d4a81a3ecea36a0afdb291;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/MediaWikiLangTestCase.php b/tests/phpunit/MediaWikiLangTestCase.php index 6dd8ea35c2..fd308b2d95 100644 --- a/tests/phpunit/MediaWikiLangTestCase.php +++ b/tests/phpunit/MediaWikiLangTestCase.php @@ -4,39 +4,21 @@ * 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(); } - }