I wanted to inspect how caches were getting setup during test-runs. So I applied
this hack https://github.com/civicrm/civicrm-core/commit/
02106e8693d13ced7a151834a4188ce8b16f6444
and then ran some tests, eg
```
CIVICRM_UF=UnitTests phpunit8 tests/phpunit/CRM/Case/WorkflowMessage/CaseActivityTest.php
```
You can see the change in the HitOrMiss report (displayed after the test).
Before
======
```
OK (3 tests, 38 assertions)
HitOrMiss: {
"ClassScanner::cache(index) => Early usage": 13,
"ClassScanner::cache(structure) => New arraycache": 1
}
```
After
=====
```
OK (3 tests, 38 assertions)
HitOrMiss: {
"ClassScanner::cache(index) => create(...)": 1,
"ClassScanner::cache(structure) => New arraycache": 2
}
```
if (!isset(static::$caches[$name])) {
switch ($name) {
case 'index':
+ global $_DB_DATAOBJECT;
if (empty($_DB_DATAOBJECT['CONFIG'])) {
// Atypical example: You have a test with a @dataProvider that relies on ClassScanner. Runs before bot.
return new \CRM_Utils_Cache_ArrayCache([]);