summaryrefslogtreecommitdiffstats
path: root/core/scripts
diff options
context:
space:
mode:
authorNathaniel Catchpole2016-03-16 11:11:46 (GMT)
committerNathaniel Catchpole2016-03-16 11:11:46 (GMT)
commita1d5f882267f1d37043063365769d9fe7efbaa47 (patch)
tree2be745608579de65e80ed15fd693eb50029f3938 /core/scripts
parentffbaa3f2ce69768b431416be0946e90ae7925bbc (diff)
Issue #2687837 by alexpott: run-tests.sh --types does not work with --directory
Diffstat (limited to 'core/scripts')
-rwxr-xr-xcore/scripts/run-tests.sh13
1 files changed, 13 insertions, 0 deletions
diff --git a/core/scripts/run-tests.sh b/core/scripts/run-tests.sh
index 1b7a45a..df61328 100755
--- a/core/scripts/run-tests.sh
+++ b/core/scripts/run-tests.sh
@@ -14,6 +14,7 @@ use Drupal\Core\StreamWrapper\PublicStream;
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);