diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2013-09-04 05:51:59 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2013-09-04 05:51:59 +0200 |
commit | 91e194556c52d2f354344f930419eef2dd6267f0 (patch) | |
tree | 0cd12490d3cd3499274017c9b799d0f738d3719e /tests/phpunit/MediaWikiLangTestCase.php | |
parent | 08aa4418c30cfc18ccc69a0f0f9cb9e17be6c196 (diff) |
Update to MediaWiki 1.21.2
Diffstat (limited to 'tests/phpunit/MediaWikiLangTestCase.php')
-rw-r--r-- | tests/phpunit/MediaWikiLangTestCase.php | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/phpunit/MediaWikiLangTestCase.php b/tests/phpunit/MediaWikiLangTestCase.php new file mode 100644 index 00000000..0cf6e383 --- /dev/null +++ b/tests/phpunit/MediaWikiLangTestCase.php @@ -0,0 +1,29 @@ +<?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() . ")" ); + } + + $langCode = 'en'; # For mainpage to be 'Main Page' + $langObj = Language::factory( $langCode ); + + $this->setMwGlobals( array( + 'wgLanguageCode' => $langCode, + 'wgLang' => $langObj, + 'wgContLang' => $langObj, + ) ); + + MessageCache::singleton()->disable(); + } +} |