Civi\Test - Allow `headless()->apply()` (etc) to execute without setup.sh
Before
------
If you have a copy of the `git` codebase and wish to run any of the headless
test suites, you *must* run `setup.sh` aka `GenCode` beforehand.
This is because certain files - `sql/civicrm.mysql` and
`sql/civicrm_data.mysql` - are used in the headless suite. As large
auto-generated files, they are not provided in git.
After
-----
The files `sql/civicrm.mysql` and `sql/civicrm_data.mysql` are no longer
required by the test suite -- the headless tests will directly use the
`GenCode` classes to produce the needful.
Comments
--------
The general thrust of this commit is to find spots which read an SQL file, e.g.
```php
\Civi\Test::execute(file_get_contents("foobar.mysql"));
```
and instead call the generator for that file, e.g.:
```php
$schema = new \CRM_Core_CodeGen_Schema(\Civi\Test::codeGen());
$result = $schema->generateFooBar();
\Civi\Test::execute($result['foobar.mysql']);
});
```
In doing so, we incorporate a couple tricks:
* The SQL content is cached for the duration of the test-run (`Civi\Test::$statics`).
Generating the SQL is not super expensive... but `Civi\Test::headless()->...apply()`
may be called thousands of times, so it could add-up. Just cache it.
* Most of the `generateFooBar()` functions depend in some fashion on `ts()`. This
commit depends on a preceding commit to make `ts()` more amenable to execution
during early stages of the test.
* Related discussion: https://chat.civicrm.org/civicrm/pl/ehohytqkf7bd5prg9w75dq4qqw