summaryrefslogtreecommitdiff
path: root/tests/phpunit/phpunit.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/phpunit/phpunit.php')
-rw-r--r--tests/phpunit/phpunit.php24
1 files changed, 16 insertions, 8 deletions
diff --git a/tests/phpunit/phpunit.php b/tests/phpunit/phpunit.php
index 2ec07440..1d65e521 100644
--- a/tests/phpunit/phpunit.php
+++ b/tests/phpunit/phpunit.php
@@ -12,7 +12,7 @@
define( 'MW_PHPUNIT_TEST', true );
// Start up MediaWiki in command-line mode
-require_once( dirname( dirname( __DIR__ ) ) . "/maintenance/Maintenance.php" );
+require_once dirname( dirname( __DIR__ ) ) . "/maintenance/Maintenance.php";
class PHPUnitMaintClass extends Maintenance {
@@ -33,6 +33,9 @@ class PHPUnitMaintClass extends Maintenance {
global $wgLocaltimezone, $wgLocalisationCacheConf;
global $wgDevelopmentWarnings;
+ // Inject test autoloader
+ require_once __DIR__ . '/../TestsAutoLoader.php';
+
// wfWarn should cause tests to fail
$wgDevelopmentWarnings = true;
@@ -50,8 +53,11 @@ class PHPUnitMaintClass extends Maintenance {
// Bug 44192 Do not attempt to send a real e-mail
Hooks::clear( 'AlternateUserMailer' );
- Hooks::register( 'AlternateUserMailer',
- function() { return false; }
+ Hooks::register(
+ 'AlternateUserMailer',
+ function () {
+ return false;
+ }
);
}
@@ -86,7 +92,6 @@ class PHPUnitMaintClass extends Maintenance {
unset( $_SERVER['argv'][$key] ); // the option
unset( $_SERVER['argv'][$key + 1] ); // its value
$_SERVER['argv'] = array_values( $_SERVER['argv'] );
-
}
}
@@ -96,16 +101,19 @@ class PHPUnitMaintClass extends Maintenance {
}
$maintClass = 'PHPUnitMaintClass';
-require( RUN_MAINTENANCE_IF_MAIN );
+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' );
-require_once( "$IP/tests/TestsAutoLoader.php" );
+if ( !class_exists( 'PHPUnit_TextUI_Command' ) ) {
+ require_once 'PHPUnit/Autoload.php';
+}
MediaWikiPHPUnitCommand::main();