Merge pull request #2540 from eileenmcnaughton/CRM-14235
[civicrm-core.git] / api / v3 / examples / UFField / Get.php
CommitLineData
6a488035 1<?php
fb32de45 2/**
3 * Test Generated example of using uf_field get API
4 * *
6a488035
TO
5 */
6function uf_field_get_example(){
fb32de45 7$params = array();
6a488035 8
fb32de45 9try{
10 $result = civicrm_api3('uf_field', 'get', $params);
11}
12catch (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}
6a488035 19
fb32de45 20return $result;
6a488035
TO
21}
22
fb32de45 23/**
6a488035
TO
24 * Function returns array of result expected from previous function
25 */
26function uf_field_get_expectedresult(){
27
ee600d6f 28 $expectedResult = array(
6a488035
TO
29 'is_error' => 0,
30 'version' => 3,
31 'count' => 1,
32 'id' => 1,
ee600d6f 33 'values' => array(
34 '1' => array(
6a488035
TO
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
fb32de45 54 return $expectedResult;
6a488035
TO
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
69d79249 62* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UFFieldTest.php
6a488035
TO
63*
64* You can see the outcome of the API tests at
69d79249 65* https://test.civicrm.org/job/CiviCRM-master-git/
6a488035
TO
66*
67* To Learn about the API read
69d79249 68* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
6a488035 69*
69d79249
E
70* Browse the api on your own site with the api explorer
71* http://MYSITE.ORG/path/to/civicrm/api/explorer
6a488035
TO
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
b259a4ab 78*/