Skip to content

Commit

Permalink
Merge pull request #20374 from eileenmcnaughton/gc4
Browse files Browse the repository at this point in the history
[NFC] [Test] Big cleanup in test class
  • Loading branch information
seamuslee001 authored May 22, 2021
2 parents 6c2450b + 9203ed4 commit 2038289
Show file tree
Hide file tree
Showing 2 changed files with 377 additions and 250 deletions.
22 changes: 22 additions & 0 deletions tests/phpunit/CiviTest/CiviUnitTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
*/

use Civi\Api4\OptionGroup;
use Civi\Api4\RelationshipType;
use Civi\Payment\System;
use Civi\Api4\OptionValue;
use League\Csv\Reader;
Expand Down Expand Up @@ -3847,4 +3848,25 @@ protected function ensureMySQLMode(array $modes): void {
CRM_Core_DAO::executeQuery("SET sql_mode = '" . implode(',', array_keys($currentModes)) . "'");
}

/**
* Delete any extraneous relationship types.
*
* @throws \API_Exception
* @throws \Civi\API\Exception\UnauthorizedException
*/
protected function deleteNonDefaultRelationshipTypes(): void {
RelationshipType::delete(FALSE)->addWhere('name_a_b', 'NOT IN', [
'Child of',
'Spouse of',
'Partner of',
'Sibling of',
'Employee of',
'Volunteer for',
'Head of Household for',
'Household Member of',
'Case Coordinator is',
'Supervised by',
])->execute();
}

}
Loading

0 comments on commit 2038289

Please sign in to comment.