From 4524fd53eaab5132cfd908b9a4236ff2e581578e Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Sat, 16 Oct 2010 10:39:00 +0000 Subject: [PATCH] If using PHPUnit version 3.5.0 or later, make use of its Autoloader --- maintenance/tests/phpunit/phpunit.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/maintenance/tests/phpunit/phpunit.php b/maintenance/tests/phpunit/phpunit.php index c643a442aa..1f20259ded 100755 --- a/maintenance/tests/phpunit/phpunit.php +++ b/maintenance/tests/phpunit/phpunit.php @@ -23,6 +23,12 @@ $wgLocaltimezone = 'UTC'; // To prevent tests from failing with SQLite, we need to turn database caching off $wgCaches[CACHE_DB] = false; -require_once( 'PHPUnit/TextUI/Command.php' ); +require_once( 'PHPUnit/Runner/Version.php' ); +if( version_compare( PHPUnit_Runner_Version::id(), '3.5.0', '>=' ) ) { + # PHPUnit 3.5.0 introduced a nice autoloader based on class name + require_once( 'PHPUnit/Autoload.php' ); +} else { + # Keep the old pre PHPUnit 3.5.0 behaviour for compatibility + require_once( 'PHPUnit/TextUI/Command.php' ); +} PHPUnit_TextUI_Command::main(); - -- 2.20.1