Merge "Assert that LocalSettings file exists"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 3 Jul 2019 12:35:00 +0000 (12:35 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 3 Jul 2019 12:35:00 +0000 (12:35 +0000)
.phpcs.xml
tests/phpunit/MediaWikiIntegrationTestCase.php

index 76234a2..8f3bd8c 100644 (file)
@@ -60,6 +60,7 @@
                <exclude-pattern>maintenance/doMaintenance\.php</exclude-pattern>
                <exclude-pattern>maintenance/mergeMessageFileList\.php</exclude-pattern>
                <exclude-pattern>maintenance/commandLine\.inc</exclude-pattern>
+               <exclude-pattern>tests/phpunit/MediaWikiIntegrationTestCase\.php</exclude-pattern>
        </rule>
        <rule ref="Generic.Files.LineLength">
                <exclude-pattern>*/languages/messages/Messages*\.php</exclude-pattern>
index 536de24..bba9d5a 100644 (file)
@@ -180,7 +180,13 @@ abstract class MediaWikiIntegrationTestCase extends PHPUnit\Framework\TestCase {
        }
 
        public static function setUpBeforeClass() {
+               global $IP;
                parent::setUpBeforeClass();
+               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