4 * Test Generated API Example.
5 * See bottom of this file for more detail.
9 * Test Generated example of using price_field create API.
15 function price_field_create_example() {
18 'name' => 'grassvariety',
19 'label' => 'Grass Variety',
20 'html_type' => 'Text',
26 $result = civicrm_api3('price_field', 'create', $params);
28 catch (CiviCRM_API3_Exception
$e) {
30 $errorMessage = $e->getMessage();
31 $errorCode = $e->getErrorCode();
32 $errorData = $e->getExtraParams();
34 'error' => $errorMessage,
35 'error_code' => $errorCode,
36 'error_data' => $errorData,
44 * Function returns array of result expected from previous function.
49 function price_field_create_expectedresult() {
51 $expectedResult = array(
59 'price_set_id' => '3',
60 'name' => 'grassvariety',
61 'label' => 'Grass Variety',
62 'html_type' => 'Text',
63 'is_enter_qty' => '1',
67 'is_display_amounts' => '',
68 'options_per_line' => '',
74 'visibility_id' => '',
79 return $expectedResult;
83 * This example has been generated from the API test suite.
84 * The test that created it is called
85 * testCreatePriceField
87 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PriceFieldTest.php
89 * You can see the outcome of the API tests at
90 * https://test.civicrm.org/job/CiviCRM-master-git/
92 * To Learn about the API read
93 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
95 * Browse the api on your own site with the api explorer
96 * http://MYSITE.ORG/path/to/civicrm/api/explorer
98 * Read more about testing here
99 * http://wiki.civicrm.org/confluence/display/CRM/Testing
101 * API Standards documentation:
102 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards