Merge pull request #17187 from alexymik/recur_contribution_source
[civicrm-core.git] / tests / phpunit / CRM / Activity / BAO / ActivityTypeTest.php
1 <?php
2
3 /**
4 * @group headless
5 */
6 class CRM_Activity_BAO_ActivityTypeTest extends CiviUnitTestCase {
7
8 /**
9 * Test ActivityType
10 */
11 public function testActivityType() {
12 $actParams = [
13 'option_group_id' => 'activity_type',
14 'name' => 'abc123',
15 'label' => 'Write Unit Test',
16 'is_active' => 1,
17 'is_default' => 0,
18 ];
19 $result = $this->callAPISuccess('option_value', 'create', $actParams);
20
21 $activity_type_id = $result['values'][$result['id']]['value'];
22
23 // instantiate the thing we want to test and read it back
24 $activityTypeObj = new CRM_Activity_BAO_ActivityType($activity_type_id);
25 $keyValuePair = $activityTypeObj->getActivityType();
26
27 $this->assertEquals($keyValuePair['machineName'], 'abc123');
28 $this->assertEquals($keyValuePair['displayLabel'], 'Write Unit Test');
29
30 // cleanup
31 $this->callAPISuccess('option_value', 'delete', ['id' => $result['id']]);
32 }
33
34 }