Regression - CiviCRM core unit tests interfere with running non-CiviCRM tests
We run our own unit tests on CiviCRM, using the tarball in our CiviCRM folder. We use a set up that @totten did many many years back when civibuild
was first created.
It ran fine on 5.54 & does not on 5.58 due to changes in core
The error is
Error: Class 'api\v4\Api4TestBase' not found in include() (line 12 of /srv/civi-sites/wmff/drupal/sites/all/modules/civicrm/ext/afform/core/tests/phpunit/Civi/Afform/AfformContactSummaryTest.php).
We are not trying to run this test & the file does not ship with CiviCRM.
There are 2 recent changes in play
- Class scanning was touched mid last year - this may not be relevant as the net effect of the code may not have changed
- A dependency was added by @colemanw in tests that DO ship with core on files that do NOT ship with core.
The net effect is that if tries & fails to load these unit test classes despite them being out-of-scope for what we are testing.
I think the basic principle is either the tests should not ship at all in the tarball or they should be shipped with their dependencies.
In this case it seems likely we should consider whether the Api4TestBase
class is mature enough to ship under Civi\Test
(with the implied support for extensions that creates). I would probably prefer to offer a trait over a BaseClass
if we do that - although there might be blockers on that.