CRM-15988 - Update generated examples
[civicrm-core.git] / api / v3 / examples / Constant / Get.php
CommitLineData
6a488035 1<?php
50fb255d 2/**
a828d7b8 3 * Test Generated example demonstrating the Constant.get API.
50fb255d 4 *
a6ec24c4 5 * @deprecated
a828d7b8 6 * The Constant api is deprecated as of CiviCRM 4.4. Please use the getoptions api action instead.
50fb255d 7 *
8 * @return array
9 * API result array
10 */
11function constant_get_example() {
12 $params = array(
a6ec24c4 13 'name' => 'activityType',
50fb255d 14 );
6a488035 15
50fb255d 16 try{
a828d7b8 17 $result = civicrm_api3('Constant', 'get', $params);
50fb255d 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;
6a488035
TO
32}
33
fb32de45 34/**
50fb255d 35 * Function returns array of result expected from previous function.
36 *
37 * @return array
38 * API result array
6a488035 39 */
50fb255d 40function constant_get_expectedresult() {
6a488035 41
edb0d67a 42 $expectedResult = array(
50fb255d 43 'is_error' => 0,
44 'version' => 3,
a6ec24c4 45 'count' => 32,
50fb255d 46 'values' => array(
a6ec24c4
CW
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',
6a488035 79 ),
a828d7b8 80 'deprecated' => 'The Constant api is deprecated as of CiviCRM 4.4. Please use the getoptions api action instead.',
50fb255d 81 );
6a488035 82
fb32de45 83 return $expectedResult;
6a488035
TO
84}
85
a828d7b8 86/*
50fb255d 87* This example has been generated from the API test suite.
a828d7b8
CW
88* The test that created it is called "testActivityType"
89* and can be found at:
69d79249 90* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ConstantTest.php
6a488035
TO
91*
92* You can see the outcome of the API tests at
69d79249 93* https://test.civicrm.org/job/CiviCRM-master-git/
6a488035
TO
94*
95* To Learn about the API read
69d79249 96* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
6a488035 97*
69d79249 98* Browse the api on your own site with the api explorer
41d4d31f 99* http://MYSITE.ORG/path/to/civicrm/api
6a488035
TO
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
b259a4ab 106*/