"phpunit/phpunit" already exists inside our composer.json's "require-dev" however this has been
entirely useless as we don't include the autoloader which would load composer's PHPUnit.
This change begins including composer's autoloader when present and also tweaks phpunit.php
to ensure PHPUnit isn't double loaded. As a result besides supporting PHPUnit via composer this
also means that we're ready to make use of any library we add to our composer.json in the future.
Change-Id: I891740e8fd3d237c5f473862027205d951f564b9
handlers can take further action based on the status of the patrol footer
* LinkCache singleton can now be altered or cleared, letting one to specify
another instance that does not rely on a database backend.
+* MediaWiki's PHPUnit tests can now use PHPUnit installed using composer --dev.
=== Bug fixes in 1.22 ===
* Disable Special:PasswordReset when $wgEnableEmail is false. Previously one
}
}
+# Load composer's autoloader if present
+if ( is_readable( "$IP/vendor/autoload.php" ) ) {
+ require_once "$IP/vendor/autoload.php";
+}
+
# Get MWInit class
require_once "$IP/includes/Init.php";
// to $maintenance->mSelf. Keep that here for b/c
$self = $maintenance->getName();
-// Detect compiled mode
+# Load composer's autoloader if present
+if ( is_readable( "$IP/vendor/autoload.php" ) ) {
+ require_once "$IP/vendor/autoload.php";
+}
# Get the MWInit class
require_once "$IP/includes/Init.php";
+# Start the autoloader, so that extensions can derive classes from core files
require_once "$IP/includes/AutoLoader.php";
# Stub the profiler
require_once "$IP/includes/profiler/Profiler.php";
$maintClass = 'PHPUnitMaintClass';
require RUN_MAINTENANCE_IF_MAIN;
-require_once 'PHPUnit/Runner/Version.php';
+if ( !class_exists( 'PHPUnit_Runner_Version') ) {
+ require_once 'PHPUnit/Runner/Version.php';
+}
if ( PHPUnit_Runner_Version::id() !== '@package_version@'
&& version_compare( PHPUnit_Runner_Version::id(), '3.6.7', '<' )
) {
die( 'PHPUnit 3.6.7 or later required, you have ' . PHPUnit_Runner_Version::id() . ".\n" );
}
-require_once 'PHPUnit/Autoload.php';
+
+if ( !class_exists( 'PHPUnit_TextUI_Command' ) ) {
+ require_once 'PHPUnit/Autoload.php';
+}
MediaWikiPHPUnitCommand::main();