3 * Test Generated example demonstrating the Constant.get API.
6 * The Constant api is deprecated as of CiviCRM 4.4. Please use the getoptions api action instead.
11 function constant_get_example() {
13 'name' => 'activityType',
17 $result = civicrm_api3('Constant', 'get', $params);
19 catch (CiviCRM_API3_Exception
$e) {
21 $errorMessage = $e->getMessage();
22 $errorCode = $e->getErrorCode();
23 $errorData = $e->getExtraParams();
25 'error' => $errorMessage,
26 'error_code' => $errorCode,
27 'error_data' => $errorData,
35 * Function returns array of result expected from previous function.
40 function constant_get_expectedresult() {
42 $expectedResult = array(
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',
61 '22' => 'Print PDF Letter',
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',
72 '44' => 'SMS delivery',
73 '45' => 'Inbound SMS',
76 '48' => 'Change Registration',
77 '49' => 'Downloaded Invoice',
78 '50' => 'Emailed Invoice',
80 'deprecated' => 'The Constant api is deprecated as of CiviCRM 4.4. Please use the getoptions api action instead.',
83 return $expectedResult;
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
92 * You can see the outcome of the API tests at
93 * https://test.civicrm.org/job/CiviCRM-master-git/
95 * To Learn about the API read
96 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
98 * Browse the api on your own site with the api explorer
99 * http://MYSITE.ORG/path/to/civicrm/api
101 * Read more about testing here
102 * http://wiki.civicrm.org/confluence/display/CRM/Testing
104 * API Standards documentation:
105 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards