4 * Test Generated API Example.
5 * See bottom of this file for more detail.
9 * Test Generated example of using uf_field replace API.
15 function uf_field_replace_example() {
18 'option.autoweight' => '',
21 'field_name' => 'first_name',
22 'field_type' => 'Contact',
23 'visibility' => 'Public Pages and Listings',
25 'label' => 'Test First Name',
30 'field_name' => 'country',
31 'field_type' => 'Contact',
32 'visibility' => 'Public Pages and Listings',
34 'label' => 'Test Country',
37 'location_type_id' => 1,
40 'field_name' => 'phone',
41 'field_type' => 'Contact',
42 'visibility' => 'Public Pages and Listings',
44 'label' => 'Test Phone',
47 'location_type_id' => 1,
54 $result = civicrm_api3('uf_field', 'replace', $params);
56 catch (CiviCRM_API3_Exception
$e) {
58 $errorMessage = $e->getMessage();
59 $errorCode = $e->getErrorCode();
60 $errorData = $e->getExtraParams();
62 'error' => $errorMessage,
63 'error_code' => $errorCode,
64 'error_data' => $errorData,
72 * Function returns array of result expected from previous function.
77 function uf_field_replace_expectedresult() {
79 $expectedResult = array(
86 'uf_group_id' => '11',
87 'field_name' => 'first_name',
94 'visibility' => 'Public Pages and Listings',
96 'is_searchable' => '1',
97 'location_type_id' => '',
98 'phone_type_id' => '',
99 'website_type_id' => '',
100 'label' => 'Test First Name',
101 'field_type' => 'Contact',
103 'is_multi_summary' => '',
107 'uf_group_id' => '11',
108 'field_name' => 'country',
115 'visibility' => 'Public Pages and Listings',
117 'is_searchable' => '1',
118 'location_type_id' => '1',
119 'phone_type_id' => '',
120 'website_type_id' => '',
121 'label' => 'Test Country',
122 'field_type' => 'Contact',
124 'is_multi_summary' => '',
128 'uf_group_id' => '11',
129 'field_name' => 'phone',
136 'visibility' => 'Public Pages and Listings',
138 'is_searchable' => '1',
139 'location_type_id' => '1',
140 'phone_type_id' => '1',
141 'website_type_id' => '',
142 'label' => 'Test Phone',
143 'field_type' => 'Contact',
145 'is_multi_summary' => '',
150 return $expectedResult;
154 * This example has been generated from the API test suite.
155 * The test that created it is called
156 * testReplaceUFFields
157 * and can be found in
158 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UFFieldTest.php
160 * You can see the outcome of the API tests at
161 * https://test.civicrm.org/job/CiviCRM-master-git/
163 * To Learn about the API read
164 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
166 * Browse the api on your own site with the api explorer
167 * http://MYSITE.ORG/path/to/civicrm/api/explorer
169 * Read more about testing here
170 * http://wiki.civicrm.org/confluence/display/CRM/Testing
172 * API Standards documentation:
173 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards