Quantcast
Viewing all articles
Browse latest Browse all 295276

Decouple run-tests.sh from the simpletest module

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.

Deprecate simpletest_script_open_browser() and --browser option in Drupal 8 and remove this in Drupal 9. All the internal functionality of simpletest_script_open_browser() is moved to simpletest.module as it is completely dependent on it.

Recommend using --verbose instead of --browser in the deprecation message.

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

User interface changes

None

API changes

simpletest_script_open_browser() is deprecated.

Data model changes

None

Release notes snippet

The --browser option in run-tests.sh has been deprecated in favor of --verbose.


Viewing all articles
Browse latest Browse all 295276

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>