Commit | Line | Data |
---|---|---|
09e1f1e3 TO |
1 | <?php |
2 | ||
3 | namespace Civi\Test; | |
4 | ||
5 | /** | |
6 | * Interface HeadlessInterface | |
7 | * @package Civi\Test | |
8 | * | |
9 | * To run your test against a fake, headless database, flag it with the | |
8e8bf584 | 10 | * HeadlessInterface. CiviTestListener will automatically boot Civi. |
09e1f1e3 TO |
11 | * |
12 | * Alternatively, if you wish to run a test in a live (CMS-enabled) environment, | |
13 | * flag it with EndToEndInterface. | |
14 | * | |
15 | * You may mix-in additional features for headless tests: | |
16 | * - HookInterface: Auto-register any functions named "hook_civicrm_foo()". | |
17 | * - TransactionalInterface: Wrap all work in a transaction, and rollback at the end. | |
18 | * | |
19 | * @see EndToEndInterface | |
20 | * @see HookInterface | |
21 | * @see TransactionalInterface | |
22 | */ | |
23 | interface HeadlessInterface { | |
24 | ||
25 | /** | |
8e8bf584 | 26 | * The setupHeadless function runs at the start of each test case, right before |
cdfe4d23 TO |
27 | * the headless environment reboots. |
28 | * | |
09e1f1e3 TO |
29 | * It should perform any necessary steps required for putting the database |
30 | * in a consistent baseline -- such as loading schema and extensions. | |
31 | * | |
cdfe4d23 | 32 | * The utility `\Civi\Test::headless()` provides a number of helper functions |
09e1f1e3 TO |
33 | * for managing this setup, and it includes optimizations to avoid redundant |
34 | * setup work. | |
35 | * | |
728bbd5b | 36 | * @see \Civi\Test |
09e1f1e3 TO |
37 | */ |
38 | public function setUpHeadless(); | |
39 | ||
40 | } |