summaryrefslogtreecommitdiff
path: root/tests/phpunit/MediaWikiLangTestCase.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/phpunit/MediaWikiLangTestCase.php')
-rw-r--r--tests/phpunit/MediaWikiLangTestCase.php33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/phpunit/MediaWikiLangTestCase.php b/tests/phpunit/MediaWikiLangTestCase.php
new file mode 100644
index 00000000..1cd6a3ba
--- /dev/null
+++ b/tests/phpunit/MediaWikiLangTestCase.php
@@ -0,0 +1,33 @@
+<?php
+
+/**
+ * Base class that store and restore the Language objects
+ */
+abstract class MediaWikiLangTestCase extends MediaWikiTestCase {
+ private static $oldLang;
+ private static $oldContLang;
+
+ public function setUp() {
+ global $wgLanguageCode, $wgLang, $wgContLang;
+
+ self::$oldLang = $wgLang;
+ self::$oldContLang = $wgContLang;
+
+ if( $wgLanguageCode != $wgContLang->getCode() ) die("nooo!");
+
+ $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;
+
+ $wgContLang = self::$oldContLang;
+ $wgLanguageCode = $wgContLang->getCode();
+ self::$oldContLang = self::$oldLang = null;
+ }
+
+}