From a654a6e79adc8f4730bb69f79e0b6a960d7d3cbe Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Tue, 20 Mar 2012 00:28:30 +0000 Subject: [PATCH] Fixed attempt to write to the wiki's upload directory during parser tests instead of /tmp, this is not allowed. I'm not sure what setupGlobals() is meant to do nowadays, that part is untested. It seems to be duplicated in ParserTest::__construct(). --- .../backend/lockmanager/LockManagerGroup.php | 8 ++++++++ tests/parser/parserTest.inc | 14 +++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/includes/filerepo/backend/lockmanager/LockManagerGroup.php b/includes/filerepo/backend/lockmanager/LockManagerGroup.php index 11e77972f8..5e533667e7 100644 --- a/includes/filerepo/backend/lockmanager/LockManagerGroup.php +++ b/includes/filerepo/backend/lockmanager/LockManagerGroup.php @@ -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 * diff --git a/tests/parser/parserTest.inc b/tests/parser/parserTest.inc index 30e451b321..deb5c5ad5a 100644 --- a/tests/parser/parserTest.inc +++ b/tests/parser/parserTest.inc @@ -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 ) { -- 2.20.1