Skip to content
Snippets Groups Projects
Commit b8500a93 authored by Alex Pott's avatar Alex Pott
Browse files

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

parent 971a73c6
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -18,9 +18,19 @@ ...@@ -18,9 +18,19 @@
function simpletest_requirements($phase) { function simpletest_requirements($phase) {
$requirements = array(); $requirements = array();
$has_phpunit = class_exists('\PHPUnit_Framework_TestCase');
$has_curl = function_exists('curl_init'); $has_curl = function_exists('curl_init');
$open_basedir = ini_get('open_basedir'); $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( $requirements['curl'] = array(
'title' => t('cURL'), 'title' => t('cURL'),
'value' => $has_curl ? t('Enabled') : t('Not found'), 'value' => $has_curl ? t('Enabled') : t('Not found'),
......
...@@ -34,6 +34,11 @@ ...@@ -34,6 +34,11 @@
const SIMPLETEST_SCRIPT_EXIT_FAILURE = 1; const SIMPLETEST_SCRIPT_EXIT_FAILURE = 1;
const SIMPLETEST_SCRIPT_EXIT_EXCEPTION = 2; 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. // Set defaults and get overrides.
list($args, $count) = simpletest_script_parse_args(); list($args, $count) = simpletest_script_parse_args();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment