Add cleanup for handlers cache.
authorStanislav Malyshev <smalyshev@gmail.com>
Thu, 15 Mar 2018 22:36:47 +0000 (15:36 -0700)
committerStanislav Malyshev <smalyshev@gmail.com>
Thu, 15 Mar 2018 22:36:47 +0000 (15:36 -0700)
This is useful if we want to override certain handler for testing
but have no way to remove it from cache otherwise.

Change-Id: Icb4f9360c6e7684d15e91a7009a5a3a3e2febb37

includes/content/ContentHandler.php

index eab3afb..3cfac8f 100644 (file)
@@ -332,6 +332,13 @@ abstract class ContentHandler {
                return self::$handlers[$modelId];
        }
 
+       /**
+        * Clean up handlers cache.
+        */
+       public static function cleanupHandlersCache() {
+               self::$handlers = [];
+       }
+
        /**
         * Returns the localized name for a given content model.
         *