summaryrefslogtreecommitdiff
path: root/www/wiki/tests/phpunit/MediaWikiLangTestCase.php
diff options
context:
space:
mode:
authorYaco <franco@reevo.org>2020-06-04 11:01:00 -0300
committerYaco <franco@reevo.org>2020-06-04 11:01:00 -0300
commitfc7369835258467bf97eb64f184b93691f9a9fd5 (patch)
treedaabd60089d2dd76d9f5fb416b005fbe159c799d /www/wiki/tests/phpunit/MediaWikiLangTestCase.php
first commit
Diffstat (limited to 'www/wiki/tests/phpunit/MediaWikiLangTestCase.php')
-rw-r--r--www/wiki/tests/phpunit/MediaWikiLangTestCase.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/www/wiki/tests/phpunit/MediaWikiLangTestCase.php b/www/wiki/tests/phpunit/MediaWikiLangTestCase.php
new file mode 100644
index 00000000..fd308b2d
--- /dev/null
+++ b/www/wiki/tests/phpunit/MediaWikiLangTestCase.php
@@ -0,0 +1,24 @@
+<?php
+
+/**
+ * Base class that store and restore the Language objects
+ */
+abstract class MediaWikiLangTestCase extends MediaWikiTestCase {
+ protected function setUp() {
+ global $wgLanguageCode, $wgContLang;
+
+ if ( $wgLanguageCode != $wgContLang->getCode() ) {
+ throw new MWException( "Error in MediaWikiLangTestCase::setUp(): " .
+ "\$wgLanguageCode ('$wgLanguageCode') is different from " .
+ "\$wgContLang->getCode() (" . $wgContLang->getCode() . ")" );
+ }
+
+ parent::setUp();
+
+ $this->setUserLang( 'en' );
+ // For mainpage to be 'Main Page'
+ $this->setContentLang( 'en' );
+
+ MessageCache::singleton()->disable();
+ }
+}