From da300d4432f4ee05d91a2cdce78b15919bd43135 Mon Sep 17 00:00:00 2001 From: Max Semenik Date: Tue, 15 Jul 2014 16:56:34 -0700 Subject: [PATCH] Fix DjVu tests isolation Change-Id: I97177572fc025c5ab4361146253d7df9c487c291 --- includes/media/MediaHandler.php | 8 ++++++++ tests/phpunit/MediaWikiTestCase.php | 1 + 2 files changed, 9 insertions(+) diff --git a/includes/media/MediaHandler.php b/includes/media/MediaHandler.php index c4aab7be9f..26126857d7 100644 --- a/includes/media/MediaHandler.php +++ b/includes/media/MediaHandler.php @@ -56,6 +56,7 @@ abstract class MediaHandler { if ( !isset( self::$handlers[$class] ) ) { self::$handlers[$class] = new $class; if ( !self::$handlers[$class]->isEnabled() ) { + wfDebug( __METHOD__ . ": $class is not enabled\n" ); self::$handlers[$class] = false; } } @@ -63,6 +64,13 @@ abstract class MediaHandler { return self::$handlers[$class]; } + /** + * Resets all static caches + */ + public static function resetCache() { + self::$handlers = array(); + } + /** * Get an associative array mapping magic word IDs to parameter names. * Will be used by the parser to identify parameters. diff --git a/tests/phpunit/MediaWikiTestCase.php b/tests/phpunit/MediaWikiTestCase.php index c9184e8534..301589542c 100644 --- a/tests/phpunit/MediaWikiTestCase.php +++ b/tests/phpunit/MediaWikiTestCase.php @@ -246,6 +246,7 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { } $this->mwGlobals = array(); RequestContext::resetMain(); + MediaHandler::resetCache(); $phpErrorLevel = intval( ini_get( 'error_reporting' ) ); -- 2.20.1