aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Starling <tstarling@users.mediawiki.org>2012-03-20 00:28:30 +0000
committerTim Starling <tstarling@users.mediawiki.org>2012-03-20 00:28:30 +0000
commita654a6e79adc8f4730bb69f79e0b6a960d7d3cbe (patch)
tree0184a11a46715c3d02d36993c37defd8dc1abd0a
parent3cad6eb042b2e9d783654f737e2c230f53933eb4 (diff)
downloadmediawikicore-a654a6e79adc8f4730bb69f79e0b6a960d7d3cbe.tar.gz
mediawikicore-a654a6e79adc8f4730bb69f79e0b6a960d7d3cbe.zip
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().
Notes
Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/114224
-rw-r--r--includes/filerepo/backend/lockmanager/LockManagerGroup.php8
-rw-r--r--tests/parser/parserTest.inc14
2 files changed, 21 insertions, 1 deletions
diff --git a/includes/filerepo/backend/lockmanager/LockManagerGroup.php b/includes/filerepo/backend/lockmanager/LockManagerGroup.php
index 11e77972f8f5..5e533667e79e 100644
--- a/includes/filerepo/backend/lockmanager/LockManagerGroup.php
+++ b/includes/filerepo/backend/lockmanager/LockManagerGroup.php
@@ -31,6 +31,14 @@ class LockManagerGroup {
}
/**
+ * 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
*
* @return void
diff --git a/tests/parser/parserTest.inc b/tests/parser/parserTest.inc
index 30e451b321f0..deb5c5ad5aee 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 ) {