Allow reset of global services.
[lhc/web/wiklou.git] / includes / session / SessionManager.php
index fc73335..2820712 100644 (file)
@@ -23,6 +23,7 @@
 
 namespace MediaWiki\Session;
 
+use MediaWiki\MediaWikiServices;
 use Psr\Log\LoggerInterface;
 use BagOStuff;
 use CachedBagOStuff;
@@ -1090,11 +1091,7 @@ final class SessionManager implements SessionManagerInterface {
         * Reset the internal caching for unit testing
         */
        public static function resetCache() {
-               if ( !defined( 'MW_PHPUNIT_TEST' ) ) {
-                       // @codeCoverageIgnoreStart
-                       throw new MWException( __METHOD__ . ' may only be called from unit tests!' );
-                       // @codeCoverageIgnoreEnd
-               }
+               MediaWikiServices::failUnlessBootstrapping( __METHOD__ );
 
                self::$globalSession = null;
                self::$globalSessionRequest = null;