diff --git a/core/modules/simpletest/simpletest.module b/core/modules/simpletest/simpletest.module index 34b9596..f5b85a5 100644 --- a/core/modules/simpletest/simpletest.module +++ b/core/modules/simpletest/simpletest.module @@ -493,8 +493,6 @@ function simpletest_log_read($test_id, $database_prefix, $test_class) { * (optional) The name of an extension to limit discovery to; e.g., 'node'. * @param string[] $types * An array of included test types. - * @param string[] $exclude_types - * (optional) An array of excluded test types. * * @return array[] * An array of tests keyed with the groups, and then keyed by test classes. @@ -509,8 +507,8 @@ function simpletest_log_read($test_id, $database_prefix, $test_class) { * ); * @endcode */ -function simpletest_test_get_all($extension = NULL, array $types = [], array $exclude_types = []) { - return \Drupal::service('test_discovery')->getTestClasses($extension, $types, $exclude_types); +function simpletest_test_get_all($extension = NULL, array $types = []) { + return \Drupal::service('test_discovery')->getTestClasses($extension, $types); } /** diff --git a/core/modules/simpletest/src/TestDiscovery.php b/core/modules/simpletest/src/TestDiscovery.php index 056e84d..e906ac9 100644 --- a/core/modules/simpletest/src/TestDiscovery.php +++ b/core/modules/simpletest/src/TestDiscovery.php @@ -105,6 +105,7 @@ public function registerTestNamespaces() { $this->testNamespaces['Drupal\\Tests\\'] = [$this->root . '/core/tests/Drupal/Tests']; $this->testNamespaces['Drupal\\KernelTests\\'] = [$this->root . '/core/tests/Drupal/KernelTests']; $this->testNamespaces['Drupal\\FunctionalTests\\'] = [$this->root . '/core/tests/Drupal/FunctionalTests']; + $this->testNamespaces['Drupal\\FunctionalJavascriptTests\\'] = [$this->root . '/core/tests/Drupal/FunctionalJavascriptTests']; $this->availableExtensions = array(); foreach ($this->getExtensions() as $name => $extension) { @@ -139,8 +140,6 @@ public function registerTestNamespaces() { * (optional) The name of an extension to limit discovery to; e.g., 'node'. * @param string[] $types * An array of included test types. - * @param string[] $exclude_types - * (optional) An array of excluded test types. * * @return array An array of tests keyed by the first * @code @@ -156,7 +155,7 @@ public function registerTestNamespaces() { * @todo Remove singular grouping; retain list of groups in 'group' key. * @see https://www.drupal.org/node/2296615 */ - public function getTestClasses($extension = NULL, array $types = [], array $exclude_types = []) { + public function getTestClasses($extension = NULL, array $types = []) { $reader = new SimpleAnnotationReader(); $reader->addNamespace('Drupal\\simpletest\\Annotation'); @@ -224,11 +223,6 @@ public function getTestClasses($extension = NULL, array $types = [], array $excl return !(is_array($element) && isset($element['type']) && !in_array($element['type'], $types)); }); } - if ($exclude_types) { - $list = NestedArray::filter($list, function ($element) use ($exclude_types) { - return !(is_array($element) && isset($element['type']) && in_array($element['type'], $exclude_types)); - }); - } return $list; } diff --git a/core/modules/simpletest/tests/src/Unit/TestInfoParsingTest.php b/core/modules/simpletest/tests/src/Unit/TestInfoParsingTest.php index 8746f42..21dfad3 100644 --- a/core/modules/simpletest/tests/src/Unit/TestInfoParsingTest.php +++ b/core/modules/simpletest/tests/src/Unit/TestInfoParsingTest.php @@ -337,43 +337,7 @@ public function testGetTestClasses() { /** * @covers ::getTestClasses */ - public function testGetTestClassesWithExcludedTypes() { - $this->setupVfsWithTestClasses(); - $class_loader = $this->prophesize(ClassLoader::class); - $module_handler = $this->prophesize(ModuleHandlerInterface::class); - - $test_discovery = new TestTestDiscovery('vfs://drupal', $class_loader->reveal(), $module_handler->reveal()); - - $extensions = [ - 'test_module' => new Extension('vfs://drupal', 'module', 'modules/test_module/test_module.info.yml'), - ]; - $test_discovery->setExtensions($extensions); - $result = $test_discovery->getTestClasses(NULL, [], ['PHPUnit-Kernel']); - $this->assertCount(2, $result); - $this->assertEquals([ - 'example' => [ - 'Drupal\Tests\test_module\Functional\FunctionalExampleTest' => [ - 'name' => 'Drupal\Tests\test_module\Functional\FunctionalExampleTest', - 'description' => 'Test description', - 'group' => 'example', - 'type' => 'PHPUnit-Functional' - ], - ], - 'example2' => [ - 'Drupal\Tests\test_module\Functional\FunctionalExampleTest2' => [ - 'name' => 'Drupal\Tests\test_module\Functional\FunctionalExampleTest2', - 'description' => 'Test description', - 'group' => 'example2', - 'type' => 'PHPUnit-Functional' - ], - ], - ], $result); - } - - /** - * @covers ::getTestClasses - */ - public function testGetTestClassesWithIncludedTypes() { + public function testGetTestClassesWithSelectedTypes() { $this->setupVfsWithTestClasses(); $class_loader = $this->prophesize(ClassLoader::class); $module_handler = $this->prophesize(ModuleHandlerInterface::class); diff --git a/core/scripts/run-tests.sh b/core/scripts/run-tests.sh index dd46347..db52e6e 100755 --- a/core/scripts/run-tests.sh +++ b/core/scripts/run-tests.sh @@ -208,10 +208,10 @@ function simpletest_script_help() { Specify the path and the extension (i.e. 'core/modules/user/user.test'). - --exclude-types + --types - Runs all tests, but excluding a certain type. Together with --all, - its for example to exclude javascript tests from being executed. + Runs just tests from the specified test type, for example + run-tests.sh --all --types= --directory Run all tests found within the specified file directory. @@ -298,7 +298,6 @@ function simpletest_script_parse_args() { 'class' => FALSE, 'file' => FALSE, 'types' => [], - 'exclude-types' => [], 'directory' => NULL, 'color' => FALSE, 'verbose' => FALSE, @@ -905,7 +904,7 @@ function simpletest_script_get_test_list() { $test_list = array(); if ($args['all'] || $args['module']) { try { - $groups = simpletest_test_get_all($args['module'], $args['types'], $args['exclude-types']); + $groups = simpletest_test_get_all($args['module'], $args['types']); } catch (Exception $e) { echo (string) $e; @@ -927,7 +926,7 @@ function simpletest_script_get_test_list() { } else { try { - $groups = simpletest_test_get_all(); + $groups = simpletest_test_get_all(NULL, $args['types']); } catch (Exception $e) { echo (string) $e; @@ -1028,7 +1027,7 @@ function simpletest_script_get_test_list() { } else { try { - $groups = simpletest_test_get_all(); + $groups = simpletest_test_get_all(NULL, $args['types']); } catch (Exception $e) { echo (string) $e;