Follow-up r86775: restub $wgLang. Not because it's a good idea, but because I can...
authorHappy-melon <happy-melon@users.mediawiki.org>
Sun, 24 Apr 2011 10:50:51 +0000 (10:50 +0000)
committerHappy-melon <happy-melon@users.mediawiki.org>
Sun, 24 Apr 2011 10:50:51 +0000 (10:50 +0000)
includes/Message.php
includes/Setup.php
includes/StubObject.php
tests/parser/parserTest.inc
tests/phpunit/includes/ArticleTablesTest.php
tests/phpunit/includes/parser/NewParserTest.php
tests/phpunit/suites/UploadFromUrlTestSuite.php

index 16af726..3ddbdcb 100644 (file)
@@ -208,7 +208,7 @@ class Message {
         * @return Message: $this
         */
        public function inLanguage( $lang ) {
-               if ( $lang instanceof Language ) {
+               if ( $lang instanceof Language || $lang instanceof StubUserLang ) {
                        $this->language = $lang;
                } elseif ( is_string( $lang ) ) {
                        if( $this->language->getCode() != $lang ) {
index bcf7549..8e95324 100644 (file)
@@ -408,7 +408,7 @@ $wgUser = RequestContext::getMain()->getUser(); # BackCompat
 /**
  * @var Language
  */
-$wgLang = RequestContext::getMain()->getLang();
+$wgLang = new StubUserLang;
 
 /**
  * @var OutputPage
index 1dd597c..78f9f64 100644 (file)
@@ -136,8 +136,6 @@ class StubContLang extends StubObject {
  * Stub object for the user language. It depends of the user preferences and
  * "uselang" parameter that can be passed to index.php. This object have to be
  * in $wgLang global.
- *
- * @deprecated since 1.18
  */
 class StubUserLang extends StubObject {
 
index b3aaee7..b1a4e22 100644 (file)
@@ -166,7 +166,7 @@ class ParserTest {
 
                // $wgContLang = new StubContLang;
                $wgUser = new User;
-               $wgLang = Language::factory( 'en' );
+               $wgLang = new StubUserLang;
                $wgOut = new StubObject( 'wgOut', 'OutputPage' );
                $wgParser = new StubObject( 'wgParser', $wgParserConf['class'], array( $wgParserConf ) );
                $wgRequest = new WebRequest;
index 537f004..6d7d05a 100644 (file)
@@ -16,7 +16,7 @@ class ArticleTablesTest extends MediaWikiTestCase {
                global $wgLanguageCode, $wgContLang, $wgLang;
                $wgLanguageCode = $this->languageCode;
                $wgContLang = Language::factory( $wgLanguageCode );
-               $wgLang = RequestContext::getMain()->getLang();
+               $wgLang = new StubUserLang;
        }
 
        /**
index 386845c..8a2c7d1 100644 (file)
@@ -76,7 +76,7 @@ class NewParserTest extends MediaWikiTestCase {
 
                // $tmpGlobals['wgContLang'] = new StubContLang;
                $tmpGlobals['wgUser'] = new User;
-               $tmpGlobals['wgLang'] = Language::factory( 'en' );
+               $tmpGlobals['wgLang'] = new StubUserLang;
                $tmpGlobals['wgOut'] = new StubObject( 'wgOut', 'OutputPage' );
                $tmpGlobals['wgParser'] = new StubObject( 'wgParser', $GLOBALS['wgParserConf']['class'], array( $GLOBALS['wgParserConf'] ) );
                $tmpGlobals['wgRequest'] = new WebRequest;
index bd18af3..db8efce 100644 (file)
@@ -48,7 +48,7 @@ class UploadFromUrlTestSuite extends PHPUnit_Framework_TestSuite {
 
                // $wgContLang = new StubContLang;
                $wgUser = new User;
-               $wgLang = Language::factory( 'en' );
+               $wgLang = new StubUserLang;
                $wgOut = new StubObject( 'wgOut', 'OutputPage' );
                $wgParser = new StubObject( 'wgParser', $wgParserConf['class'], array( $wgParserConf ) );
                $wgRequest = new WebRequest;