Move trivially compatible tests to the unit tests suite
[lhc/web/wiklou.git] / tests / phpunit / MediaWikiUnitTestCase.php
index 407be20..c1dc0f9 100644 (file)
@@ -1,7 +1,5 @@
 <?php
 /**
- * Base class for MediaWiki unit tests.
- *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
 
 use PHPUnit\Framework\TestCase;
 
+/**
+ * Base class for unit tests.
+ *
+ * Extend this class if you are testing classes which use dependency injection and do not access
+ * global functions, variables, services or a storage backend.
+ */
 abstract class MediaWikiUnitTestCase extends TestCase {
        use PHPUnit4And6Compat;
        use MediaWikiCoversValidator;
+       use MediaWikiGroupValidator;
+
+       /**
+        * @throws ReflectionException
+        */
+       protected function setUp() {
+               parent::setUp();
+               if ( $this->isTestInDatabaseGroup() ) {
+                       throw new \Exception( get_class( $this ) .
+                         ' extends MediaWikiUnitTestCase, and may not have the @group Database annotation.' );
+               }
+       }
+
 }