Fix DjVu tests isolation
authorMax Semenik <maxsem.wiki@gmail.com>
Tue, 15 Jul 2014 23:56:34 +0000 (16:56 -0700)
committerMax Semenik <maxsem.wiki@gmail.com>
Tue, 15 Jul 2014 23:56:34 +0000 (16:56 -0700)
Change-Id: I97177572fc025c5ab4361146253d7df9c487c291

includes/media/MediaHandler.php
tests/phpunit/MediaWikiTestCase.php

index c4aab7b..2612685 100644 (file)
@@ -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.
index c9184e8..3015895 100644 (file)
@@ -246,6 +246,7 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase {
                }
                $this->mwGlobals = array();
                RequestContext::resetMain();
+               MediaHandler::resetCache();
 
                $phpErrorLevel = intval( ini_get( 'error_reporting' ) );