Commit b8500a93 authored by alexpott's avatar alexpott

Issue #2780093 by Mile23: Have simpletest, run-tests.sh enforce their dependency on PHPUnit

parent 971a73c6
......@@ -18,9 +18,19 @@
function simpletest_requirements($phase) {
$requirements = array();
$has_phpunit = class_exists('\PHPUnit_Framework_TestCase');
$has_curl = function_exists('curl_init');
$open_basedir = ini_get('open_basedir');
$requirements['phpunit'] = array(
'title' => t('PHPUnit dependency'),
'value' => $has_phpunit ? t('Found') : t('Not found'),
);
if (!$has_phpunit) {
$requirements['phpunit']['severity'] = REQUIREMENT_ERROR;
$requirements['phpunit']['description'] = t("The testing framework requires the PHPUnit package. Please run 'composer install --dev' to ensure it is present.");
}
$requirements['curl'] = array(
'title' => t('cURL'),
'value' => $has_curl ? t('Enabled') : t('Not found'),
......
......@@ -34,6 +34,11 @@
const SIMPLETEST_SCRIPT_EXIT_FAILURE = 1;
const SIMPLETEST_SCRIPT_EXIT_EXCEPTION = 2;
if (!class_exists('\PHPUnit_Framework_TestCase')) {
echo "\nrun-tests.sh requires the PHPUnit testing framework. Please use 'composer install --dev' to ensure that it is present.\n\n";
exit(SIMPLETEST_SCRIPT_EXIT_FAILURE);
}
// Set defaults and get overrides.
list($args, $count) = simpletest_script_parse_args();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment