Commit | Line | Data |
---|---|---|
dcd0adb5 TO |
1 | # org.civicrm.afform-mock |
2 | ||
d9627958 TO |
3 | This is a dummy extension used for integration testing. It should only |
4 | enabled on development sites. | |
5 | ||
6 | ## Basic Usage | |
dcd0adb5 TO |
7 | |
8 | ``` | |
9 | cd afform/mock | |
10 | cv en afform_mock | |
d9627958 TO |
11 | phpunit6 --group headless |
12 | phpunit6 --group e2e | |
dcd0adb5 | 13 | ``` |
d9627958 TO |
14 | |
15 | ## File Organization | |
16 | ||
17 | Here are a few key folders: | |
18 | ||
19 | * `ang/*`: These are example forms. Each example has 1-3 fils: | |
20 | * `FORMNAME.aff.html` (the layout/markup) | |
21 | * `FORMANME.aff.json` (metadata describing the form) | |
22 | * `FORMNAME.test.php` (PHPUnit class which uses the form) | |
23 | * `tests/phpunit/api/v4/*`: These tests are focused on the behavior/dynamics | |
24 | of the API. (To wit: if you update a `server_route`, does the live | |
25 | `server_route` change accordingly?) | |
26 | ||
27 | ## PHPUnit Logical Organization | |
28 | ||
29 | For tests in `ang/FORMNAME.test.php`: | |
30 | ||
31 | * The test focuses on using the specific form. | |
32 | * The test declares `@group e2e` and `@group ang`. | |
33 | * The test extends `Civi\AfformMock\FormTestCase`. This has helpers like `prefill(...)` and `submit(...)` (which call | |
34 | the AJAX interface for `Afform.prefill` and `Afform.submit` respectively). It builds on `HttpTestTrait`. | |
35 | ||
36 | For tests in `tests/phpunit/api/v4`: | |
37 | ||
38 | * The tests focuses on Afform's APIv4 contract (entities/actions/parameters) | |
39 | * The tests may use either `@group e2e` (`EndToEndInterface`) or `@group headless` | |
40 | (`HeadlessInterface`). |