Commit | Line | Data |
---|---|---|
6a488035 | 1 | <?php |
fb32de45 | 2 | /** |
3 | * Test Generated example of using uf_field get API | |
4 | * * | |
6a488035 TO |
5 | */ |
6 | function uf_field_get_example(){ | |
fb32de45 | 7 | $params = array(); |
6a488035 | 8 | |
fb32de45 | 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 | } | |
6a488035 | 19 | |
fb32de45 | 20 | return $result; |
6a488035 TO |
21 | } |
22 | ||
fb32de45 | 23 | /** |
6a488035 TO |
24 | * Function returns array of result expected from previous function |
25 | */ | |
26 | function 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 | |
62 | * http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/UFFieldTest.php | |
63 | * | |
64 | * You can see the outcome of the API tests at | |
65 | * http://tests.dev.civicrm.org/trunk/results-api_v3 | |
66 | * | |
67 | * To Learn about the API read | |
68 | * http://book.civicrm.org/developer/current/techniques/api/ | |
69 | * | |
70 | * and review the wiki at | |
71 | * http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs | |
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 | */ |