Commit | Line | Data |
---|---|---|
09e1f1e3 TO |
1 | <?php |
2 | ||
3 | namespace Civi\Test; | |
4 | ||
5 | /** | |
6 | * Interface HookInterface | |
7 | * @package Civi\Test | |
8 | * | |
9 | * This interface allows you to subscribe to hooks as part of the test. | |
10 | * Simply create an eponymous hook function (e.g. `hook_civicrm_post()`). | |
11 | * | |
12 | * @code | |
13 | * class MyTest extends \PHPUnit_Framework_TestCase implements \Civi\Test\HookInterface { | |
14 | * public function hook_civicrm_post($op, $objectName, $objectId, &$objectRef) { | |
15 | * echo "Running hook_civicrm_post\n"; | |
16 | * } | |
17 | * } | |
18 | * @endCode | |
19 | * | |
20 | * At time of writing, there are a few limitations in how HookInterface is handled | |
21 | * by CiviTestListener: | |
22 | * | |
23 | * - The test must execute in-process (aka HeadlessInterface; aka CIVICRM_UF==UnitTests). | |
24 | * End-to-end tests (multi-process tests) are not supported. | |
25 | * - Early bootstrap hooks (e.g. hook_civicrm_config) are not supported. | |
26 | * | |
27 | * @see CiviTestListener | |
28 | */ | |
29 | interface HookInterface { | |
30 | } |