Problem/Motivation

Now that we have an extensible CLI solution in core, we may think about converting run-tests.sh to it.

IMHO we should break down the old all-in-one script in a set of commands, like e.g.

  • test:list to address the scope of the --list, --list-files and --list-files-json options
  • test:cleanup to address the scope of the --clean option
  • test:run to do the main purpose - running tests in parallel/concurrent way

Opportunites worth exploring in the journey:

  • review the CLI options to align with PHPUnit's ones - e.g. renaming --types to --testsuite, etc.
  • change from comma-separated list of things to Symfony's array options i.e. from --types unit,kernel to --testsuite unit --testsuite kernel
  • Prevent these commands from being available in prod
  • Prevent these commands from being available if PHPUnit is not installed (or fail meaningfully if we're in test env)
  • Prevent these commands from being available if tests are not present (or fail meaningfully if we're in test env)

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3595595

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mondrake created an issue. See original summary.

mstrelan’s picture

One thing to consider here is how this affects production environments. I don't have specific comments on this, but in general:

  • These commands should ideally not be available in prod
  • PHPUnit also shouldn't exist in prod
  • If we end up distributing drupal without tests then this should also be excluded

I guess this is no different to run-tests.sh though, so might not be applicable?

mradcliffe’s picture

I think hiding in the production environment probably depends on things like #3446545: Allow specifying the environment for the kernel using an environment variables or #3590337: Introduce an AppContext object to keep track of the configured Drupal application context, but maybe composer since phpunit won't be available at all (hopefully).

mondrake’s picture

mondrake’s picture

POC for dr test:list in MR!16050. Used LLM support initially to get a split for the base test command class and the concrete test list class.