Merge "Fix global objects and singletons in NewParserTest"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 16 May 2013 16:19:44 +0000 (16:19 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 16 May 2013 16:19:44 +0000 (16:19 +0000)
tests/phpunit/includes/parser/NewParserTest.php

index db352de..288fa82 100644 (file)
@@ -99,9 +99,6 @@ class NewParserTest extends MediaWikiTestCase {
                                'createtalk' => true,
                ) );
                $tmpGlobals['wgNamespaceProtection'] = array( NS_MEDIAWIKI => 'editinterface' );
-               $tmpGlobals['wgMemc'] = new EmptyBagOStuff;
-               $tmpGlobals['messageMemc'] = wfGetMessageCacheStorage();
-               $tmpGlobals['parserMemc'] = wfGetParserCacheStorage();
 
                $tmpGlobals['wgParser'] = new StubObject( 'wgParser', $GLOBALS['wgParserConf']['class'], array( $GLOBALS['wgParserConf'] ) );
 
@@ -141,6 +138,12 @@ class NewParserTest extends MediaWikiTestCase {
                RepoGroup::destroySingleton();
                FileBackendGroup::destroySingleton();
 
+               // Remove temporary pages from the link cache
+               LinkCache::singleton()->clear();
+
+               // Restore message cache (temporary pages and $wgUseDatabaseMessages)
+               MessageCache::destroyInstance();
+
                parent::tearDown();
        }
 
@@ -196,9 +199,6 @@ class NewParserTest extends MediaWikiTestCase {
                        __METHOD__
                );
 
-               # Clear the message cache
-               MessageCache::singleton()->clear();
-
                $user = User::newFromId( 0 );
                LinkCache::singleton()->clear(); # Avoids the odd failure at creating the nullRevision
 
@@ -375,6 +375,8 @@ class NewParserTest extends MediaWikiTestCase {
                }
 
                MagicWord::clearCache();
+
+               # The entries saved into RepoGroup cache with previous globals will be wrong.
                RepoGroup::destroySingleton();
                FileBackendGroup::destroySingleton();
 
@@ -384,9 +386,6 @@ class NewParserTest extends MediaWikiTestCase {
                # Publish the articles after we have the final language set
                $this->publishTestArticles();
 
-               # The entries saved into RepoGroup cache with previous globals will be wrong.
-               RepoGroup::destroySingleton();
-               FileBackendGroup::destroySingleton();
                MessageCache::destroyInstance();
 
                return $context;
@@ -453,9 +452,6 @@ class NewParserTest extends MediaWikiTestCase {
                foreach ( $this->savedGlobals as $var => $val ) {
                        $GLOBALS[$var] = $val;
                }
-
-               RepoGroup::destroySingleton();
-               LinkCache::singleton()->clear();
        }
 
        /**