Fix phpunit when using run-tests.sh in Drupal 8 and 9
In #3548261, the `.phpunit-base-script` definition was modified to pass `--all` to `run-tests.sh` in most cases. This works because even though `--all` is documented to “Run all available tests.”, it does not actually do that. Instead, it will still apply some of the filter params, most importantly `--directory` which in our case filters to the contrib module’s directory like we want.
However, back in Drupal 8 the `--all` option for `run-tests.sh` still worked a bit more like documented, ignoring at least `--directory` and test groups, as far as I can tell. That means that after this change, Drupal 8 pipelines for contrib modules will attempt to run all tests, including those defined by Core, and consequently run into a timeout. See [here](https://www.drupal.org/project/searchstax/issues/3607141) for an example.
I’m not sure why the `--all` option exists at all, to be honest, when it just seems to mean “ignore an undocumented subset of options”, but probably fixing Core’s `run-tests.sh` script is a bit trickier than just fixing the template. (And, in any case, wouldn’t solve my issue.) Still, to be a good trouper, I [created a ticket for that](https://www.drupal.org/project/drupal/issues/3607159), too.
Unfortunately I don’t understand the original issue well enough to propose any actual change, but to me it seems like `--all` can be omitted in many more scenarios. If `--directory` is passed, for instance, it should always be unnecessary as far as I can see.
As a side note, I also don’t really understand this line:
```
WHAT_TO_RUN=$([[ "$_PHPUNIT_TESTGROUPS" == "" ]] && echo "" || ([[ "$_PHPUNIT_TESTGROUPS" == "--all" ]] && echo "--all" || echo "$_PHPUNIT_TESTGROUPS"))
```
Isn’t that just a very complicated way of setting `WHAT_TO_RUN="$_PHPUNIT_TESTGROUPS"`? In my mind, this might be the place to check whether something like `--directory` is set and set `WHAT_TO_RUN=''` in that case.
issue