Ian province abbreviation patch - issue 724
[civicrm-core.git] / api / v3 / examples / Constant / Get.php
1 <?php
2 /**
3 * Test Generated example demonstrating the Constant.get API.
4 *
5 * @deprecated
6 * The Constant api is deprecated as of CiviCRM 4.4. Please use the getoptions api action instead.
7 *
8 * @return array
9 * API result array
10 */
11 function constant_get_example() {
12 $params = array(
13 'name' => 'activityType',
14 );
15
16 try{
17 $result = civicrm_api3('Constant', 'get', $params);
18 }
19 catch (CiviCRM_API3_Exception $e) {
20 // Handle error here.
21 $errorMessage = $e->getMessage();
22 $errorCode = $e->getErrorCode();
23 $errorData = $e->getExtraParams();
24 return array(
25 'error' => $errorMessage,
26 'error_code' => $errorCode,
27 'error_data' => $errorData,
28 );
29 }
30
31 return $result;
32 }
33
34 /**
35 * Function returns array of result expected from previous function.
36 *
37 * @return array
38 * API result array
39 */
40 function constant_get_expectedresult() {
41
42 $expectedResult = array(
43 'is_error' => 0,
44 'version' => 3,
45 'count' => 32,
46 'values' => array(
47 '1' => 'Meeting',
48 '2' => 'Phone Call',
49 '3' => 'Email',
50 '4' => 'Outbound SMS',
51 '5' => 'Event Registration',
52 '6' => 'Contribution',
53 '7' => 'Membership Signup',
54 '8' => 'Membership Renewal',
55 '9' => 'Tell a Friend',
56 '10' => 'Pledge Acknowledgment',
57 '11' => 'Pledge Reminder',
58 '12' => 'Inbound Email',
59 '17' => 'Membership Renewal Reminder',
60 '19' => 'Bulk Email',
61 '22' => 'Print PDF Letter',
62 '34' => 'Mass SMS',
63 '35' => 'Change Membership Status',
64 '36' => 'Change Membership Type',
65 '37' => 'Cancel Recurring Contribution',
66 '38' => 'Update Recurring Contribution Billing Details',
67 '39' => 'Update Recurring Contribution',
68 '40' => 'Reminder Sent',
69 '41' => 'Export Accounting Batch',
70 '42' => 'Create Batch',
71 '43' => 'Edit Batch',
72 '44' => 'SMS delivery',
73 '45' => 'Inbound SMS',
74 '46' => 'Payment',
75 '47' => 'Refund',
76 '48' => 'Change Registration',
77 '49' => 'Downloaded Invoice',
78 '50' => 'Emailed Invoice',
79 ),
80 'deprecated' => 'The Constant api is deprecated as of CiviCRM 4.4. Please use the getoptions api action instead.',
81 );
82
83 return $expectedResult;
84 }
85
86 /*
87 * This example has been generated from the API test suite.
88 * The test that created it is called "testActivityType"
89 * and can be found at:
90 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ConstantTest.php
91 *
92 * You can see the outcome of the API tests at
93 * https://test.civicrm.org/job/CiviCRM-master-git/
94 *
95 * To Learn about the API read
96 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
97 *
98 * Browse the api on your own site with the api explorer
99 * http://MYSITE.ORG/path/to/civicrm/api
100 *
101 * Read more about testing here
102 * http://wiki.civicrm.org/confluence/display/CRM/Testing
103 *
104 * API Standards documentation:
105 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
106 */