Add logic to avoid running PHPUNIT if the project has no phpunit tests

Issue information

From user: jonathan1055

Related to !139 (merged)

Contribution record

Fork management

Problem/Motivation

From #3397270: Nightwatch testing against all opted in versions

[the phpunit failure] is only happening because the phpunit job is assumed to always run unless one explicitly opts out by setting SKIP_PHPUNIT='1'. Arguably we should have similar exists logic for PHPUnit, then projects like Decoupled Pages or CKEditor 5 Paste Filter, which have only Nightwatch, would no longer have to set SKIP_PHPUNIT.

In addition to the normal opt-in and skip- rules, Nightwatch tests include

    - exists:
        - tests/src/Nightwatch/**/*.js
        - modules/*/tests/src/Nightwatch/**/*.js
      when: on_success

Proposed resolution

Add similar exists checks in phpunit, to only attempt to run if the project actually has phpunit tests.

Remaining tasks

Edited by drupalbot
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information