From ed92fc2103e3921ed138190ef794a422917f1a2a Mon Sep 17 00:00:00 2001 From: Kosta Harlan Date: Wed, 14 Aug 2019 10:25:01 +0200 Subject: [PATCH] Tests: Allow vendor/bin/phpunit from within extension directory Prior to this patch, one could not run this command from within an extension directory: `../../vendor/bin/phpunit -c ../../phpunit.xml.dist tests/phpunit`, because our code in bootstrap.php loaded "LocalSettings.php" instead of $IP/LocalSettings.php. Note that making this change does not result in loading LocalSettings.php when running unit tests. Bug: T87781 Change-Id: Iee8440f11a2bb255567646289a1986d636c12765 --- tests/phpunit/bootstrap.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/phpunit/bootstrap.php b/tests/phpunit/bootstrap.php index 4400475bee..f227ae1626 100644 --- a/tests/phpunit/bootstrap.php +++ b/tests/phpunit/bootstrap.php @@ -49,10 +49,9 @@ function wfRequireOnceInGlobalScope( $fileName ) { define( 'MEDIAWIKI', true ); define( 'MW_PHPUNIT_TEST', true ); -// We don't use a settings file here but some code still assumes that one exists -define( 'MW_CONFIG_FILE', 'LocalSettings.php' ); - $IP = realpath( __DIR__ . '/../../' ); +// We don't use a settings file here but some code still assumes that one exists +define( 'MW_CONFIG_FILE', "$IP/LocalSettings.php" ); // these variables must be defined before setup runs $GLOBALS['IP'] = $IP; -- 2.20.1