Add a dedicated Exception for SessionOverflow
[lhc/web/wiklou.git] / tests / phpunit / MediaWikiUnitTestCase.php
index 76e8f7d..fda986c 100644 (file)
@@ -20,6 +20,7 @@
  */
 
 use PHPUnit\Framework\TestCase;
+use PHPUnit\Framework\Exception;
 
 /**
  * Base class for unit tests.
@@ -101,6 +102,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