From b5b10866e21dedb91d7faa265a9383a4f520c517 Mon Sep 17 00:00:00 2001 From: Petr Skoda Date: Sun, 8 Apr 2012 17:20:24 +0200 Subject: [PATCH] MDL-32323 require at least PHPUnit 3.6.0 --- lib/phpunit/bootstrap.php | 8 ++++++++ lib/phpunit/bootstraplib.php | 10 +++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/lib/phpunit/bootstrap.php b/lib/phpunit/bootstrap.php index b9547ef0dd7..8f4023597ce 100644 --- a/lib/phpunit/bootstrap.php +++ b/lib/phpunit/bootstrap.php @@ -59,6 +59,14 @@ if (defined('CLI_SCRIPT')) { } define('CLI_SCRIPT', true); +$phpunitversion = PHPUnit_Runner_Version::id(); +if ($phpunitversion === '@package_version@') { + // library checked out from git, let's hope dev knows that 3.6.0 is required +} else if (version_compare($phpunitversion, '3.6.0', 'lt')) { + phpunit_bootstrap_error(129, $phpunitversion); +} +unset($phpunitversion); + define('NO_OUTPUT_BUFFERING', true); // only load CFG from config.php, stop ASAP in lib/setup.php diff --git a/lib/phpunit/bootstraplib.php b/lib/phpunit/bootstraplib.php index 03b895d1f4f..42964c68d59 100644 --- a/lib/phpunit/bootstraplib.php +++ b/lib/phpunit/bootstraplib.php @@ -39,10 +39,14 @@ function phpunit_bootstrap_error($errorcode, $text = '') { case 1: $text = 'Error: '.$text; break; + case 129: + $text = 'Moodle requires PHPUnit 3.6.x, '.$text.' is not compatible'; + break; case 130: - $text = 'Can not load PHPUnit PEAR library, is it installed?'; + $text = 'Moodle can not find PHPUnit PEAR library'; + break; case 131: - $text = 'Configuration problem: '.$text; + $text = 'Moodle configuration problem: '.$text; break; case 132: $text = "Moodle PHPUnit environment is not initialised, please use:\n php admin/tool/phpunit/cli/util.php --install"; @@ -51,7 +55,7 @@ function phpunit_bootstrap_error($errorcode, $text = '') { $text = "Moodle PHPUnit environment was initialised for different version, please use:\n php admin/tool/phpunit/cli/util.php --drop\n php admin/tool/phpunit/cli/util.php --install"; break; case 134: - $text = 'Can not create main configuration file, please verify dirroot permissions.'; + $text = 'Moodle can not create PHPUnit configuration file, please verify dirroot permissions'; break; default: $text = empty($text) ? '' : ': '.$text;