Fixed attempt to write to the wiki's upload directory during parser tests instead...
authorTim Starling <tstarling@users.mediawiki.org>
Tue, 20 Mar 2012 00:28:30 +0000 (00:28 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Tue, 20 Mar 2012 00:28:30 +0000 (00:28 +0000)
includes/filerepo/backend/lockmanager/LockManagerGroup.php
tests/parser/parserTest.inc

index 11e7797..5e53366 100644 (file)
@@ -30,6 +30,14 @@ class LockManagerGroup {
                return self::$instance;
        }
 
+       /**
+        * Destroy the singleton instance, so that a new one will be created next
+        * time singleton() is called.
+        */
+       public static function destroySingleton() {
+               self::$instance = null;
+       }
+
        /**
         * Register lock managers from the global variables
         * 
index 30e451b..deb5c5a 100644 (file)
@@ -140,7 +140,7 @@ class ParserTest {
                        $wgNamespaceAliases, $wgNamespaceProtection, $wgLocalFileRepo,
                        $parserMemc, $wgThumbnailScriptPath, $wgScriptPath,
                        $wgArticlePath, $wgStyleSheetPath, $wgScript, $wgStylePath, $wgExtensionAssetsPath,
-                       $wgMainCacheType, $wgMessageCacheType, $wgParserCacheType;
+                       $wgMainCacheType, $wgMessageCacheType, $wgParserCacheType, $wgLockManagers;
 
                $wgScript = '/index.php';
                $wgScriptPath = '/';
@@ -149,6 +149,11 @@ class ParserTest {
                $wgStylePath = '/skins';
                $wgExtensionAssetsPath = '/extensions';
                $wgThumbnailScriptPath = false;
+               $wgLockManagers = array( array(
+                       'name'          => 'fsLockManager',
+                       'class'         => 'FSLockManager',
+                       'lockDirectory' => wfTempDir() . '/test-repo/lockdir',
+               ) );
                $wgLocalFileRepo = array(
                        'class'           => 'LocalRepo',
                        'name'            => 'local',
@@ -627,6 +632,11 @@ class ParserTest {
                        'wgScriptPath' => '/',
                        'wgArticlePath' => '/wiki/$1',
                        'wgActionPaths' => array(),
+                       'wgLockManagers' => array(
+                               'name'          => 'fsLockManager',
+                               'class'         => 'FSLockManager',
+                               'lockDirectory' => $this->uploadDir . '/lockdir',
+                       ),
                        'wgLocalFileRepo' => array(
                                'class' => 'LocalRepo',
                                'name' => 'local',
@@ -951,6 +961,8 @@ class ParserTest {
         */
        private function teardownGlobals() {
                RepoGroup::destroySingleton();
+               FileBackendGroup::destroySingleton();
+               LockManagerGroup::destroySingleton();
                LinkCache::singleton()->clear();
 
                foreach ( $this->savedGlobals as $var => $val ) {