Tests: Allow vendor/bin/phpunit from within extension directory
authorKosta Harlan <kharlan@wikimedia.org>
Wed, 14 Aug 2019 08:25:01 +0000 (10:25 +0200)
committerKosta Harlan <kharlan@wikimedia.org>
Wed, 14 Aug 2019 08:30:25 +0000 (10:30 +0200)
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

index 4400475..f227ae1 100644 (file)
@@ -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;