ClassScanner - Fix guard for preboot cache scenario
authorTim Otten <totten@civicrm.org>
Thu, 8 Sep 2022 00:40:44 +0000 (17:40 -0700)
committerTim Otten <totten@civicrm.org>
Thu, 8 Sep 2022 00:40:44 +0000 (17:40 -0700)
commitee7b8b95a389a533b0bcc541463d249d244f9356
tree058c55aef9adc37e6fb75345e1a6684ca5bca476
parent0217f12bb7fdde6a8a17d439a8d8a7be55be7373
ClassScanner - Fix guard for preboot cache scenario

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
}
```
Civi/Core/ClassScanner.php