Skip to content

Commit

Permalink
Test fix up
Browse files Browse the repository at this point in the history
  • Loading branch information
eileenmcnaughton committed Aug 17, 2022
1 parent 2ea3b3a commit dede95b
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions tests/phpunit/api/v3/SettingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ class api_v3_SettingTest extends CiviUnitTestCase {
protected $domainID2;
protected $domainID3;

/**
* @throws \CRM_Core_Exception
*/
public function setUp(): void {
parent::setUp();
$params = [
Expand All @@ -49,26 +52,34 @@ public function setUp(): void {
}

public function tearDown(): void {
CRM_Utils_Hook::singleton()->reset();
parent::tearDown();
$this->callAPISuccess('system', 'flush', []);
CRM_Core_DAO::executeQuery('DELETE FROM civicrm_domain WHERE name LIKE "' . __CLASS__ . '%"');
CRM_Core_DAO::executeQuery('
DELETE d, s, n, dc, m
FROM civicrm_domain d
INNER JOIN civicrm_setting s on s.domain_id = d.id
INNER JOIN civicrm_navigation n on n.domain_id = d.id
INNER JOIN civicrm_menu m on m.domain_id = d.id
INNER JOIN civicrm_dashboard_contact dc on dc.domain_id = d.id
WHERE d.name LIKE "' . __CLASS__ . '%"
');
}

/**
* Set additional settings into metadata (implements hook)
*
* @param array $metaDataFolders
*/
public function setExtensionMetadata(&$metaDataFolders) {
public function setExtensionMetadata(array &$metaDataFolders): void {
global $civicrm_root;
$metaDataFolders[] = $civicrm_root . '/tests/phpunit/api/v3/settings';
}

/**
* @param int $version
*
* @dataProvider versionThreeAndFour
*/
public function testGetFields($version) {
public function testGetFields(int $version): void {
$this->_apiversion = $version;
$description = 'Demonstrate return from getfields - see sub-folder for variants';
$result = $this->callAPIAndDocument('setting', 'getfields', [], __FUNCTION__, __FILE__, $description);
Expand Down

0 comments on commit dede95b

Please sign in to comment.