Merge pull request #5187 from mallezie/CRM-15982
[civicrm-core.git] / api / v3 / examples / UFGroup / Get.php
1 <?php
2 /**
3 * Test Generated example of using uf_group get API.
4 *
5 * @return array
6 * API result array
7 */
8 function uf_group_get_example() {
9 $params = array(
10 'id' => 2,
11 );
12
13 try{
14 $result = civicrm_api3('uf_group', 'get', $params);
15 }
16 catch (CiviCRM_API3_Exception $e) {
17 // Handle error here.
18 $errorMessage = $e->getMessage();
19 $errorCode = $e->getErrorCode();
20 $errorData = $e->getExtraParams();
21 return array(
22 'error' => $errorMessage,
23 'error_code' => $errorCode,
24 'error_data' => $errorData,
25 );
26 }
27
28 return $result;
29 }
30
31 /**
32 * Function returns array of result expected from previous function.
33 *
34 * @return array
35 * API result array
36 */
37 function uf_group_get_expectedresult() {
38
39 $expectedResult = array(
40 'is_error' => 0,
41 'version' => 3,
42 'count' => 1,
43 'id' => 2,
44 'values' => array(
45 '2' => array(
46 'id' => '2',
47 'is_active' => 0,
48 'group_type' => 'Individual,Contact',
49 'title' => 'Test Group',
50 'help_pre' => 'help pre',
51 'help_post' => 'help post',
52 'limit_listings_group_id' => '1',
53 'post_URL' => 'http://example.org/post',
54 'add_to_group_id' => '1',
55 'add_captcha' => '1',
56 'is_map' => '1',
57 'is_edit_link' => '1',
58 'is_uf_link' => '1',
59 'is_update_dupe' => '1',
60 'cancel_URL' => 'http://example.org/cancel',
61 'is_cms_user' => '1',
62 'notify' => 'admin@example.org',
63 'is_reserved' => '1',
64 'name' => 'Test_Group_2',
65 'created_id' => '1',
66 'created_date' => '2013-07-28 08:49:19',
67 'is_proximity_search' => 0,
68 ),
69 ),
70 );
71
72 return $expectedResult;
73 }
74
75 /**
76 * This example has been generated from the API test suite.
77 * The test that created it is called
78 * testUFGroupGet
79 * and can be found in
80 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UFGroupTest.php
81 *
82 * You can see the outcome of the API tests at
83 * https://test.civicrm.org/job/CiviCRM-master-git/
84 *
85 * To Learn about the API read
86 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
87 *
88 * Browse the api on your own site with the api explorer
89 * http://MYSITE.ORG/path/to/civicrm/api
90 *
91 * Read more about testing here
92 * http://wiki.civicrm.org/confluence/display/CRM/Testing
93 *
94 * API Standards documentation:
95 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
96 */