Commit | Line | Data |
---|---|---|
01542df4 TO |
1 | <?php |
2 | ||
3 | use Civi\Test\HeadlessInterface; | |
4 | use Civi\Test\TransactionalInterface; | |
5 | ||
6 | /** | |
7 | * Base class for Afform API tests. | |
8 | */ | |
cf41f25a | 9 | abstract class api_v4_AfformTestCase extends \PHPUnit\Framework\TestCase implements HeadlessInterface, TransactionalInterface { |
01542df4 TO |
10 | |
11 | /** | |
12 | * Civi\Test has many helpers, like install(), uninstall(), sql(), and sqlFile(). | |
13 | * See: https://github.com/civicrm/org.civicrm.testapalooza/blob/master/civi-test.md | |
14 | */ | |
15 | public function setUpHeadless() { | |
16 | return \Civi\Test::headless() | |
17 | ->install(['org.civicrm.api4', 'org.civicrm.afform', 'org.civicrm.afform-mock']) | |
18 | ->apply(); | |
19 | } | |
20 | ||
21 | /** | |
22 | * The setup() method is executed before the test is executed (optional). | |
23 | */ | |
24 | public function setUp() { | |
25 | parent::setUp(); | |
26 | CRM_Core_Config::singleton()->userPermissionTemp = new CRM_Core_Permission_Temp(); | |
27 | CRM_Core_Config::singleton()->userPermissionTemp->grant('administer CiviCRM'); | |
28 | } | |
29 | ||
30 | /** | |
31 | * The tearDown() method is executed after the test was executed (optional) | |
32 | * This can be used for cleanup. | |
33 | */ | |
34 | public function tearDown() { | |
35 | parent::tearDown(); | |
36 | } | |
37 | ||
38 | } |