(dev/core#4088) ClassScanner - Move unit-test registration
authorTim Otten <totten@civicrm.org>
Wed, 25 Jan 2023 01:06:57 +0000 (17:06 -0800)
committerTim Otten <totten@civicrm.org>
Wed, 25 Jan 2023 01:34:22 +0000 (17:34 -0800)
commit65abec3ff988e6d0cb22cfacce065723bedb86e4
tree68443cd38789899797b81aafa5fd43e349ccf106
parent58380bb6394a7543050a6b3f8d8727f3bdfe45b8
(dev/core#4088) ClassScanner - Move unit-test registration

Before: The `ClassScanner` includes a special  rule to load some
mocks/examples from `tests/phpunit/` which are needed for some core tests.
But (reportedly) it will load even when running other test-suites.

After: The special rule has moved to the `bootstrap.php` for
core tests. It should be inert when running other test-suites.

Technical Details: I believe the reason why the special rule was originally
embedded into `ClassScanner` was that `ClassScanner` has special place in
bootstrap/system-lifecycle.  To get around this, the patch adds
`CIVICRM_FORCE_MODULES` as a way to pre-register some hook listeners.  (To
wit: `civitest` is a "force-enabled module" defined by `bootstrap.php`.
It's always-on; it can participate in special/pre-boot hooks; and it
doesn't present as a configurable extension. You might also call it
a "ghost module"...)
CRM/Utils/Hook.php
Civi/Core/ClassScanner.php
tests/phpunit/CiviTest/bootstrap.php