Per comment on r87680: make parser tests work again.
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Mon, 23 May 2011 17:22:14 +0000 (17:22 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Mon, 23 May 2011 17:22:14 +0000 (17:22 +0000)
Can somebody explain me why on earth do we need ParserTest::setUp() since all of this is done before each test in ParserTest::setupGlobals()?

tests/parser/parserTest.inc

index b1a4e22..55092cd 100644 (file)
@@ -166,8 +166,9 @@ class ParserTest {
 
                // $wgContLang = new StubContLang;
                $wgUser = new User;
-               $wgLang = new StubUserLang;
-               $wgOut = new StubObject( 'wgOut', 'OutputPage' );
+               $context = new RequestContext;
+               $wgLang = $context->getLang();
+               $wgOut = $context->getOutput();
                $wgParser = new StubObject( 'wgParser', $wgParserConf['class'], array( $wgParserConf ) );
                $wgRequest = new WebRequest;
 
@@ -678,13 +679,14 @@ class ParserTest {
                        $GLOBALS[$var] = $val;
                }
 
-               $langObj = Language::factory( $lang );
-               $GLOBALS['wgContLang'] = $langObj;
+               $GLOBALS['wgContLang'] = Language::factory( $lang );
+               $GLOBALS['wgMemc'] = new EmptyBagOStuff;
+
                $context = new RequestContext();
                $GLOBALS['wgLang'] = $context->getLang();
+               $GLOBALS['wgOut'] = $context->getOutput();
 
-               $GLOBALS['wgMemc'] = new EmptyBagOStuff;
-               $GLOBALS['wgOut'] = new $context->output;
+               $GLOBALS['wgUser'] = new User();
 
                global $wgHooks;
 
@@ -693,9 +695,6 @@ class ParserTest {
                $wgHooks['ParserGetVariableValueTs'][] = 'ParserTest::getFakeTimestamp';
 
                MagicWord::clearCache();
-
-               global $wgUser;
-               $wgUser = new User();
        }
 
        /**