3 * Test Generated example demonstrating the OptionGroup.create API.
8 function option_group_create_example() {
11 'name' => 'civicrm_event.amount.560',
14 'api.OptionValue.create' => array(
15 'label' => 'workshop',
19 'format.only_id' => 1,
24 $result = civicrm_api3('OptionGroup', 'create', $params);
26 catch (CiviCRM_API3_Exception
$e) {
28 $errorMessage = $e->getMessage();
29 $errorCode = $e->getErrorCode();
30 $errorData = $e->getExtraParams();
32 'error' => $errorMessage,
33 'error_code' => $errorCode,
34 'error_data' => $errorData,
42 * Function returns array of result expected from previous function.
47 function option_group_create_expectedresult() {
49 $expectedResult = array(
57 'name' => 'civicrm_event.amount.560',
63 'api.OptionValue.create' => 784,
68 return $expectedResult;
72 * This example has been generated from the API test suite.
73 * The test that created it is called "testGetOptionCreateSuccess"
74 * and can be found at:
75 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/OptionGroupTest.php
77 * You can see the outcome of the API tests at
78 * https://test.civicrm.org/job/CiviCRM-master-git/
80 * To Learn about the API read
81 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
83 * Browse the api on your own site with the api explorer
84 * http://MYSITE.ORG/path/to/civicrm/api
86 * Read more about testing here
87 * http://wiki.civicrm.org/confluence/display/CRM/Testing
89 * API Standards documentation:
90 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards