Problem/Motivation
In #3057420: [meta] How to deprecate Simpletest with minimal disruption we are contemplating making simpletest a contrib module.
That issue has many steps involved in decoupling run-tests.sh (the test runner) from simpletest module. This issue is one of those steps.
Note that run-tests.sh can already be run without the simpletest module installed in a site: https://www.drupal.org/docs/8/phpunit/running-tests-through-command-line...
Scope of this issue
The scope of this issue is to decouple run-tests.sh from the simpletest module. This will allow current behavior from run-tests.sh even if the simpletest module itself is removed from the codebase. As a child issue of #3057420: [meta] How to deprecate Simpletest with minimal disruption, we wish to do this with minimal disruption.
Some proof of concept for removing the simpletest module is occurring in #3075490-28: Move simpletest module to contrib
Things we’ll need to solve
run-tests.sh uses logic like this in order to figure out how to run tests it discovers:
foreach ($matches[1] as $class_name) {
$namespace_class = $namespace . '\\' . $class_name;
if (is_subclass_of($namespace_class, '\Drupal\simpletest\TestBase') || is_subclass_of($namespace_class, TestCase::class)) {
$test_list[] = $namespace_class;
}
}
We want to make \Drupal\simpletest\TestBase
a soft dependency, so that run-tests.sh can operate completely independently of the simpletest module.
run-tests.sh also uses Drupal\simpletest\Form\SimpletestResultsForm::addResultForm()
, so that it can build the results form for its --browser
option. This should be turned into a lightweight form element builder somewhere within the Drupal\Core\Tests\
namespace, so that it can be used by both run-tests.sh and simpletest as contrib.
Proposed resolution
Remove code-based assumptions from run-tests.sh that there are two types of tests, and if a test class is not a PHPUnit test, then it must be a simpletest-based one.
Refactor the parts of SimpletestResultsForm
that are used by run-tests.sh into an @internal
helper class, in order to support the --browser
option.
Remaining tasks
Other remaining issues from #3057420: [meta] How to deprecate Simpletest with minimal disruption
Eventually remove the simpletest module #3075490: Move simpletest module to contrib