Merge pull request #15085 from seamuslee001/update_examples
[civicrm-core.git] / api / v3 / examples / ActivityType / Get.php
1 <?php
2 /**
3 * Test Generated example demonstrating the ActivityType.get API.
4 *
5 * @deprecated
6 * The ActivityType api is deprecated. Please use the OptionValue api instead.
7 *
8 * @return array
9 * API result array
10 */
11 function activity_type_get_example() {
12 $params = [];
13
14 try{
15 $result = civicrm_api3('ActivityType', 'get', $params);
16 }
17 catch (CiviCRM_API3_Exception $e) {
18 // Handle error here.
19 $errorMessage = $e->getMessage();
20 $errorCode = $e->getErrorCode();
21 $errorData = $e->getExtraParams();
22 return [
23 'is_error' => 1,
24 'error_message' => $errorMessage,
25 'error_code' => $errorCode,
26 'error_data' => $errorData,
27 ];
28 }
29
30 return $result;
31 }
32
33 /**
34 * Function returns array of result expected from previous function.
35 *
36 * @return array
37 * API result array
38 */
39 function activity_type_get_expectedresult() {
40
41 $expectedResult = [
42 'is_error' => 0,
43 'version' => 3,
44 'count' => 35,
45 'values' => [
46 '1' => 'Meeting',
47 '2' => 'Phone Call',
48 '3' => 'Email',
49 '4' => 'Outbound SMS',
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',
58 '17' => 'Membership Renewal Reminder',
59 '19' => 'Bulk Email',
60 '22' => 'Print/Merge Document',
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',
71 '44' => 'SMS delivery',
72 '45' => 'Inbound SMS',
73 '46' => 'Payment',
74 '47' => 'Refund',
75 '48' => 'Change Registration',
76 '49' => 'Downloaded Invoice',
77 '50' => 'Emailed Invoice',
78 '51' => 'Contact Merged',
79 '52' => 'Contact Deleted by Merge',
80 '54' => 'Failed Payment',
81 ],
82 'deprecated' => 'The ActivityType api is deprecated. Please use the OptionValue api instead.',
83 ];
84
85 return $expectedResult;
86 }
87
88 /*
89 * This example has been generated from the API test suite.
90 * The test that created it is called "testActivityTypeGet"
91 * and can be found at:
92 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityTypeTest.php
93 *
94 * You can see the outcome of the API tests at
95 * https://test.civicrm.org/job/CiviCRM-Core-Matrix/
96 *
97 * To Learn about the API read
98 * https://docs.civicrm.org/dev/en/latest/api/
99 *
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.
102 *
103 * Read more about testing here
104 * https://docs.civicrm.org/dev/en/latest/testing/
105 *
106 * API Standards documentation:
107 * https://docs.civicrm.org/dev/en/latest/framework/api-architecture/
108 */