Skip to content
Snippets Groups Projects
Commit a1d5f882 authored by catch's avatar catch
Browse files

Issue #2687837 by alexpott: run-tests.sh --types does not work with --directory

parent ffbaa3f2
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
......@@ -14,6 +14,7 @@
use Drupal\Core\Test\TestRunnerKernel;
use Drupal\simpletest\Form\SimpletestResultsForm;
use Drupal\simpletest\TestBase;
use Drupal\simpletest\TestDiscovery;
use Symfony\Component\HttpFoundation\Request;
$autoloader = require_once __DIR__ . '/../../autoload.php';
......@@ -913,10 +914,12 @@ function simpletest_script_cleanup($test_id, $test_class, $exitcode) {
function simpletest_script_get_test_list() {
global $args;
$types_processed = empty($args['types']);
$test_list = array();
if ($args['all'] || $args['module']) {
try {
$groups = simpletest_test_get_all($args['module'], $args['types']);
$types_processed = TRUE;
}
catch (Exception $e) {
echo (string) $e;
......@@ -1040,6 +1043,7 @@ function simpletest_script_get_test_list() {
else {
try {
$groups = simpletest_test_get_all(NULL, $args['types']);
$types_processed = TRUE;
}
catch (Exception $e) {
echo (string) $e;
......@@ -1058,6 +1062,15 @@ function simpletest_script_get_test_list() {
}
}
// If the test list creation does not automatically limit by test type then
// we need to do so here.
if (!$types_processed) {
$test_list = array_filter($test_list, function ($test_class) use ($args) {
$test_info = TestDiscovery::getTestInfo($test_class);
return in_array($test_info['type'], $args['types'], TRUE);
});
}
if (empty($test_list)) {
simpletest_script_print_error('No valid tests were specified.');
exit(SIMPLETEST_SCRIPT_EXIT_FAILURE);
......
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