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:listto address the scope of the--list,--list-filesand--list-files-jsonoptionstest:cleanupto address the scope of the--cleanoptiontest:runto 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
--typesto--testsuite, etc. - change from comma-separated list of things to Symfony's array options i.e. from
--types unit,kernelto--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
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
Comment #2
mstrelan commentedOne thing to consider here is how this affects production environments. I don't have specific comments on this, but in general:
I guess this is no different to
run-tests.shthough, so might not be applicable?Comment #3
mradcliffeI 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).
Comment #4
mondrakeThanks for input, edited the IS and linked issues accordingly
Comment #6
mondrakePOC for
dr test:listin MR!16050. Used LLM support initially to get a split for the base test command class and the concrete test list class.