Split some Language methods to LanguageNameUtils
[lhc/web/wiklou.git] / tests / phpunit / MediaWikiUnitTestCase.php
index 76e8f7d..c63056d 100644 (file)
@@ -20,6 +20,7 @@
  */
 
 use PHPUnit\Framework\TestCase;
+use PHPUnit\Framework\Exception;
 
 /**
  * Base class for unit tests.
@@ -52,7 +53,8 @@ abstract class MediaWikiUnitTestCase extends TestCase {
                        'wgAutoloadLocalClasses',
                        // Need for LoggerFactory. Default is NullSpi.
                        'wgMWLoggerDefaultSpi',
-                       'wgAutoloadAttemptLowercase'
+                       'wgAutoloadAttemptLowercase',
+                       'wgLegalTitleChars'
                ];
        }
 
@@ -101,6 +103,22 @@ abstract class MediaWikiUnitTestCase extends TestCase {
                }
        }
 
+       /**
+        * @inheritDoc
+        */
+       protected function runTest() {
+               try {
+                       return parent::runTest();
+               } catch ( ConfigException $exception ) {
+                       throw new Exception(
+                               'Config variables must be mocked, they cannot be accessed directly in tests which extend '
+                               . self::class,
+                               $exception->getCode(),
+                               $exception
+                       );
+               }
+       }
+
        protected function tearDown() {
                if ( !defined( 'HHVM_VERSION' ) ) {
                        // Quick reset between tests