Skip to content

Commit

Permalink
Avoid duplicate activity types
Browse files Browse the repository at this point in the history
  • Loading branch information
demeritcowboy committed Nov 15, 2019
1 parent 8285640 commit 0ca4b20
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions tests/phpunit/CiviTest/CiviCaseTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,23 @@ public function setUp() {
'name' => 'case_status',
'format.only_id' => 1,
));
$optionValues = array(
$optionValues = [
'Medical evaluation' => 'Medical evaluation',
'Mental health evaluation' => "Mental health evaluation",
'Secure temporary housing' => 'Secure temporary housing',
'Long-term housing plan' => 'Long-term housing plan',
'ADC referral' => 'ADC referral',
'Income and benefits stabilization' => 'Income and benefits stabilization',
);
];
foreach ($optionValues as $name => $label) {
$activityTypes = $this->callAPISuccess('option_value', 'Create', array(
'option_group_id' => 2,
$activityTypes = CRM_Core_BAO_OptionValue::ensureOptionValueExists([
'option_group_id' => 'activity_type',
'name' => $name,
'label' => $label,
'component_id' => 7,
));
'component_id' => 'CiviCase',
]);
// store for cleanup
// @todo is this ever used?
$this->optionValues[] = $activityTypes['id'];
}

Expand Down

0 comments on commit 0ca4b20

Please sign in to comment.