update examples"
[civicrm-core.git] / api / v3 / examples / CustomGroup / Get.php
CommitLineData
6a488035 1<?php
fb32de45 2/**
50fb255d 3 * @file
4 * Test Generated API Example.
5 * See bottom of this file for more detail.
6a488035 6 */
6a488035 7
50fb255d 8/**
9 * Test Generated example of using custom_group get API.
10 *
11 *
12 * @return array
13 * API result array
14 */
15function custom_group_get_example() {
16 $params = array();
6a488035 17
50fb255d 18 try{
19 $result = civicrm_api3('custom_group', 'get', $params);
20 }
21 catch (CiviCRM_API3_Exception $e) {
22 // Handle error here.
23 $errorMessage = $e->getMessage();
24 $errorCode = $e->getErrorCode();
25 $errorData = $e->getExtraParams();
26 return array(
27 'error' => $errorMessage,
28 'error_code' => $errorCode,
29 'error_data' => $errorData,
30 );
31 }
32
33 return $result;
6a488035
TO
34}
35
fb32de45 36/**
50fb255d 37 * Function returns array of result expected from previous function.
38 *
39 * @return array
40 * API result array
6a488035 41 */
50fb255d 42function custom_group_get_expectedresult() {
6a488035 43
53ca8fd7 44 $expectedResult = array(
50fb255d 45 'is_error' => 0,
46 'version' => 3,
47 'count' => 1,
48 'id' => 1,
49 'values' => array(
53ca8fd7 50 '1' => array(
50fb255d 51 'id' => '1',
52 'name' => 'test_group_1',
53 'title' => 'Test_Group_1',
54 'extends' => 'Individual',
55 'style' => 'Inline',
56 'collapse_display' => '1',
57 'help_pre' => 'This is Pre Help For Test Group 1',
58 'help_post' => 'This is Post Help For Test Group 1',
59 'weight' => '2',
60 'is_active' => '1',
61 'table_name' => 'civicrm_value_test_group_1_1',
62 'is_multiple' => 0,
63 'collapse_adv_display' => 0,
64 'is_reserved' => 0,
65 ),
6a488035 66 ),
50fb255d 67 );
6a488035 68
fb32de45 69 return $expectedResult;
6a488035
TO
70}
71
50fb255d 72/**
73* This example has been generated from the API test suite.
74* The test that created it is called
75* testGetCustomGroupSuccess
76* and can be found in
69d79249 77* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CustomGroupTest.php
6a488035
TO
78*
79* You can see the outcome of the API tests at
69d79249 80* https://test.civicrm.org/job/CiviCRM-master-git/
6a488035
TO
81*
82* To Learn about the API read
69d79249 83* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
6a488035 84*
69d79249
E
85* Browse the api on your own site with the api explorer
86* http://MYSITE.ORG/path/to/civicrm/api/explorer
6a488035
TO
87*
88* Read more about testing here
89* http://wiki.civicrm.org/confluence/display/CRM/Testing
90*
91* API Standards documentation:
92* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
b259a4ab 93*/