Merge pull request #2540 from eileenmcnaughton/CRM-14235
[civicrm-core.git] / api / v3 / examples / UFField / Get.php
1 <?php
2 /**
3 * Test Generated example of using uf_field get API
4 * *
5 */
6 function uf_field_get_example(){
7 $params = array();
8
9 try{
10 $result = civicrm_api3('uf_field', 'get', $params);
11 }
12 catch (CiviCRM_API3_Exception $e) {
13 // handle error here
14 $errorMessage = $e->getMessage();
15 $errorCode = $e->getErrorCode();
16 $errorData = $e->getExtraParams();
17 return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData);
18 }
19
20 return $result;
21 }
22
23 /**
24 * Function returns array of result expected from previous function
25 */
26 function uf_field_get_expectedresult(){
27
28 $expectedResult = array(
29 'is_error' => 0,
30 'version' => 3,
31 'count' => 1,
32 'id' => 1,
33 'values' => array(
34 '1' => array(
35 'id' => '1',
36 'uf_group_id' => '11',
37 'field_name' => 'phone',
38 'is_active' => '1',
39 'is_view' => 0,
40 'is_required' => 0,
41 'weight' => '1',
42 'visibility' => 'Public Pages and Listings',
43 'in_selector' => 0,
44 'is_searchable' => '1',
45 'location_type_id' => '1',
46 'phone_type_id' => '1',
47 'label' => 'Test Phone',
48 'field_type' => 'Contact',
49 'is_multi_summary' => 0,
50 ),
51 ),
52 );
53
54 return $expectedResult;
55 }
56
57
58 /*
59 * This example has been generated from the API test suite. The test that created it is called
60 *
61 * testGetUFFieldSuccess and can be found in
62 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UFFieldTest.php
63 *
64 * You can see the outcome of the API tests at
65 * https://test.civicrm.org/job/CiviCRM-master-git/
66 *
67 * To Learn about the API read
68 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
69 *
70 * Browse the api on your own site with the api explorer
71 * http://MYSITE.ORG/path/to/civicrm/api/explorer
72 *
73 * Read more about testing here
74 * http://wiki.civicrm.org/confluence/display/CRM/Testing
75 *
76 * API Standards documentation:
77 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
78 */