Commit | Line | Data |
---|---|---|
6a488035 | 1 | <?php |
50fb255d | 2 | /** |
a828d7b8 | 3 | * Test Generated example demonstrating the ActivityType.get API. |
50fb255d | 4 | * |
a6ec24c4 | 5 | * @deprecated |
a828d7b8 | 6 | * The ActivityType api is deprecated. Please use the OptionValue api instead. |
50fb255d | 7 | * |
8 | * @return array | |
9 | * API result array | |
10 | */ | |
11 | function activity_type_get_example() { | |
cf8f0fff | 12 | $params = []; |
6a488035 | 13 | |
50fb255d | 14 | try{ |
a828d7b8 | 15 | $result = civicrm_api3('ActivityType', 'get', $params); |
50fb255d | 16 | } |
17 | catch (CiviCRM_API3_Exception $e) { | |
18 | // Handle error here. | |
19 | $errorMessage = $e->getMessage(); | |
20 | $errorCode = $e->getErrorCode(); | |
21 | $errorData = $e->getExtraParams(); | |
cf8f0fff | 22 | return [ |
5be22f39 | 23 | 'is_error' => 1, |
24 | 'error_message' => $errorMessage, | |
50fb255d | 25 | 'error_code' => $errorCode, |
26 | 'error_data' => $errorData, | |
cf8f0fff | 27 | ]; |
50fb255d | 28 | } |
29 | ||
30 | return $result; | |
6a488035 TO |
31 | } |
32 | ||
fb32de45 | 33 | /** |
50fb255d | 34 | * Function returns array of result expected from previous function. |
35 | * | |
36 | * @return array | |
37 | * API result array | |
6a488035 | 38 | */ |
50fb255d | 39 | function activity_type_get_expectedresult() { |
6a488035 | 40 | |
cf8f0fff | 41 | $expectedResult = [ |
50fb255d | 42 | 'is_error' => 0, |
43 | 'version' => 3, | |
8390b11b | 44 | 'count' => 35, |
cf8f0fff | 45 | 'values' => [ |
6a488035 TO |
46 | '1' => 'Meeting', |
47 | '2' => 'Phone Call', | |
48 | '3' => 'Email', | |
edb0d67a | 49 | '4' => 'Outbound SMS', |
6a488035 TO |
50 | '5' => 'Event Registration', |
51 | '6' => 'Contribution', | |
52 | '7' => 'Membership Signup', | |
53 | '8' => 'Membership Renewal', | |
54 | '9' => 'Tell a Friend', | |
55 | '10' => 'Pledge Acknowledgment', | |
56 | '11' => 'Pledge Reminder', | |
57 | '12' => 'Inbound Email', | |
6a488035 | 58 | '17' => 'Membership Renewal Reminder', |
6a488035 | 59 | '19' => 'Bulk Email', |
5be22f39 | 60 | '22' => 'Print/Merge Document', |
6a488035 TO |
61 | '34' => 'Mass SMS', |
62 | '35' => 'Change Membership Status', | |
63 | '36' => 'Change Membership Type', | |
64 | '37' => 'Cancel Recurring Contribution', | |
65 | '38' => 'Update Recurring Contribution Billing Details', | |
66 | '39' => 'Update Recurring Contribution', | |
67 | '40' => 'Reminder Sent', | |
68 | '41' => 'Export Accounting Batch', | |
69 | '42' => 'Create Batch', | |
70 | '43' => 'Edit Batch', | |
edb0d67a | 71 | '44' => 'SMS delivery', |
72 | '45' => 'Inbound SMS', | |
89bf81b4 | 73 | '46' => 'Payment', |
74 | '47' => 'Refund', | |
75 | '48' => 'Change Registration', | |
50fb255d | 76 | '49' => 'Downloaded Invoice', |
77 | '50' => 'Emailed Invoice', | |
5be22f39 | 78 | '51' => 'Contact Merged', |
79 | '52' => 'Contact Deleted by Merge', | |
8390b11b | 80 | '54' => 'Failed Payment', |
cf8f0fff | 81 | ], |
a828d7b8 | 82 | 'deprecated' => 'The ActivityType api is deprecated. Please use the OptionValue api instead.', |
cf8f0fff | 83 | ]; |
6a488035 | 84 | |
fb32de45 | 85 | return $expectedResult; |
6a488035 TO |
86 | } |
87 | ||
a828d7b8 | 88 | /* |
50fb255d | 89 | * This example has been generated from the API test suite. |
a828d7b8 CW |
90 | * The test that created it is called "testActivityTypeGet" |
91 | * and can be found at: | |
69d79249 | 92 | * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityTypeTest.php |
6a488035 TO |
93 | * |
94 | * You can see the outcome of the API tests at | |
8390b11b | 95 | * https://test.civicrm.org/job/CiviCRM-Core-Matrix/ |
6a488035 TO |
96 | * |
97 | * To Learn about the API read | |
8390b11b | 98 | * https://docs.civicrm.org/dev/en/latest/api/ |
6a488035 | 99 | * |
8390b11b SL |
100 | * Browse the API on your own site with the API Explorer. It is in the main |
101 | * CiviCRM menu, under: Support > Development > API Explorer. | |
6a488035 TO |
102 | * |
103 | * Read more about testing here | |
8390b11b | 104 | * https://docs.civicrm.org/dev/en/latest/testing/ |
6a488035 TO |
105 | * |
106 | * API Standards documentation: | |
8390b11b | 107 | * https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ |
b259a4ab | 108 | */ |