From 822efb467dc152424f0ddd53da87877544bed12a Mon Sep 17 00:00:00 2001 From: Kosta Harlan Date: Mon, 1 Jul 2019 16:31:48 -0400 Subject: [PATCH] Assert that LocalSettings file exists This time, use $IP to get correct path to LocalSettings so that tests can be run from outside MediaWiki root. Change-Id: I0dd3dd281cff67b0d8acdc09b97328c44eca2bb6 Follows-Up: Ia36d22217f94e019bb5945705243bd0daace72e0 Bug: T226977 --- .phpcs.xml | 1 + tests/phpunit/MediaWikiIntegrationTestCase.php | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/.phpcs.xml b/.phpcs.xml index 76234a2b56..8f3bd8c527 100644 --- a/.phpcs.xml +++ b/.phpcs.xml @@ -60,6 +60,7 @@ maintenance/doMaintenance\.php maintenance/mergeMessageFileList\.php maintenance/commandLine\.inc + tests/phpunit/MediaWikiIntegrationTestCase\.php */languages/messages/Messages*\.php diff --git a/tests/phpunit/MediaWikiIntegrationTestCase.php b/tests/phpunit/MediaWikiIntegrationTestCase.php index 536de24680..bba9d5ad73 100644 --- a/tests/phpunit/MediaWikiIntegrationTestCase.php +++ b/tests/phpunit/MediaWikiIntegrationTestCase.php @@ -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 -- 2.20.1