Merge "Exclude redirects from Special:Fewestrevisions"
[lhc/web/wiklou.git] / tests / phpunit / MediaWikiIntegrationTestCase.php
index 3216d21..07d135d 100644 (file)
@@ -180,8 +180,13 @@ abstract class MediaWikiIntegrationTestCase extends PHPUnit\Framework\TestCase {
        }
 
        public static function setUpBeforeClass() {
+               global $IP;
                parent::setUpBeforeClass();
-               \PHPUnit\Framework\Assert::assertFileExists( 'LocalSettings.php' );
+               if ( !file_exists( "$IP/LocalSettings.php" ) ) {
+                       echo 'A working MediaWiki installation with a configured LocalSettings.php file is'
+                       . ' required for tests that extend ' . self::class;
+                       die();
+               }
                self::initializeForStandardPhpunitEntrypointIfNeeded();
 
                // Get the original service locator
@@ -535,6 +540,11 @@ abstract class MediaWikiIntegrationTestCase extends PHPUnit\Framework\TestCase {
 
        protected function setUp() {
                parent::setUp();
+               $reflection = new ReflectionClass( $this );
+               // TODO: Eventually we should assert for test presence in /integration/
+               if ( strpos( $reflection->getFilename(), '/unit/' ) !== false ) {
+                       $this->fail( 'This integration test should not be in "tests/phpunit/unit" !' );
+               }
                $this->called['setUp'] = true;
 
                $this->phpErrorLevel = intval( ini_get( 'error_reporting' ) );