| 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 |
| 10 | * HeadlessInterface. CiviTestListener will automatically boot Civi. |
| 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 | /** |
| 26 | * The setupHeadless function runs at the start of each test case, right before |
| 27 | * the headless environment reboots. |
| 28 | * |
| 29 | * It should perform any necessary steps required for putting the database |
| 30 | * in a consistent baseline -- such as loading schema and extensions. |
| 31 | * |
| 32 | * The utility `\Civi\Test::headless()` provides a number of helper functions |
| 33 | * for managing this setup, and it includes optimizations to avoid redundant |
| 34 | * setup work. |
| 35 | * |
| 36 | * @see \Civi\Test |
| 37 | */ |
| 38 | public function setUpHeadless(); |
| 39 | |
| 40 | } |