* This is a generic test class implemented with PHPUnit.
* @group headless
*/
-class api_v4_AfformTest extends \PHPUnit_Framework_TestCase implements HeadlessInterface, TransactionalInterface {
-
- /**
- * Civi\Test has many helpers, like install(), uninstall(), sql(), and sqlFile().
- * See: https://github.com/civicrm/org.civicrm.testapalooza/blob/master/civi-test.md
- */
- public function setUpHeadless() {
- return \Civi\Test::headless()
- ->install(['org.civicrm.api4', 'org.civicrm.afform', 'org.civicrm.afform-mock'])
- ->apply();
- }
-
- /**
- * The setup() method is executed before the test is executed (optional).
- */
- public function setUp() {
- parent::setUp();
- CRM_Core_Config::singleton()->userPermissionTemp = new CRM_Core_Permission_Temp();
- CRM_Core_Config::singleton()->userPermissionTemp->grant('administer CiviCRM');
- }
-
- /**
- * The tearDown() method is executed after the test was executed (optional)
- * This can be used for cleanup.
- */
- public function tearDown() {
- parent::tearDown();
- }
+class api_v4_AfformTest extends api_v4_AfformTestCase {
public function getBasicDirectives() {
return [
--- /dev/null
+<?php
+
+use Civi\Test\HeadlessInterface;
+use Civi\Test\TransactionalInterface;
+
+/**
+ * Base class for Afform API tests.
+ */
+abstract class api_v4_AfformTestCase extends \PHPUnit_Framework_TestCase implements HeadlessInterface, TransactionalInterface {
+
+ /**
+ * Civi\Test has many helpers, like install(), uninstall(), sql(), and sqlFile().
+ * See: https://github.com/civicrm/org.civicrm.testapalooza/blob/master/civi-test.md
+ */
+ public function setUpHeadless() {
+ return \Civi\Test::headless()
+ ->install(['org.civicrm.api4', 'org.civicrm.afform', 'org.civicrm.afform-mock'])
+ ->apply();
+ }
+
+ /**
+ * The setup() method is executed before the test is executed (optional).
+ */
+ public function setUp() {
+ parent::setUp();
+ CRM_Core_Config::singleton()->userPermissionTemp = new CRM_Core_Permission_Temp();
+ CRM_Core_Config::singleton()->userPermissionTemp->grant('administer CiviCRM');
+ }
+
+ /**
+ * The tearDown() method is executed after the test was executed (optional)
+ * This can be used for cleanup.
+ */
+ public function tearDown() {
+ parent::tearDown();
+ }
+
+}