| 1 | <?php |
| 2 | /** |
| 3 | * Test Generated example of using custom_group get API |
| 4 | * * |
| 5 | */ |
| 6 | function custom_group_get_example(){ |
| 7 | $params = array(); |
| 8 | |
| 9 | try{ |
| 10 | $result = civicrm_api3('custom_group', '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 custom_group_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 | 'name' => 'test_group_1', |
| 37 | 'title' => 'Test_Group_1', |
| 38 | 'extends' => 'Individual', |
| 39 | 'style' => 'Inline', |
| 40 | 'collapse_display' => '1', |
| 41 | 'help_pre' => 'This is Pre Help For Test Group 1', |
| 42 | 'help_post' => 'This is Post Help For Test Group 1', |
| 43 | 'weight' => '2', |
| 44 | 'is_active' => '1', |
| 45 | 'table_name' => 'civicrm_value_test_group_1_1', |
| 46 | 'is_multiple' => 0, |
| 47 | 'collapse_adv_display' => 0, |
| 48 | 'is_reserved' => 0, |
| 49 | ), |
| 50 | ), |
| 51 | ); |
| 52 | |
| 53 | return $expectedResult; |
| 54 | } |
| 55 | |
| 56 | |
| 57 | /* |
| 58 | * This example has been generated from the API test suite. The test that created it is called |
| 59 | * |
| 60 | * testGetCustomGroupSuccess and can be found in |
| 61 | * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CustomGroupTest.php |
| 62 | * |
| 63 | * You can see the outcome of the API tests at |
| 64 | * https://test.civicrm.org/job/CiviCRM-master-git/ |
| 65 | * |
| 66 | * To Learn about the API read |
| 67 | * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API |
| 68 | * |
| 69 | * Browse the api on your own site with the api explorer |
| 70 | * http://MYSITE.ORG/path/to/civicrm/api/explorer |
| 71 | * |
| 72 | * Read more about testing here |
| 73 | * http://wiki.civicrm.org/confluence/display/CRM/Testing |
| 74 | * |
| 75 | * API Standards documentation: |
| 76 | * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards |
| 77 | */ |