3 * Test Generated example of using line_item create API.
9 function line_item_create_example() {
11 'price_field_value_id' => 1,
12 'price_field_id' => 1,
13 'entity_table' => 'civicrm_contribution',
22 $result = civicrm_api3('line_item', 'create', $params);
24 catch (CiviCRM_API3_Exception
$e) {
26 $errorMessage = $e->getMessage();
27 $errorCode = $e->getErrorCode();
28 $errorData = $e->getExtraParams();
30 'error' => $errorMessage,
31 'error_code' => $errorCode,
32 'error_data' => $errorData,
40 * Function returns array of result expected from previous function.
45 function line_item_create_expectedresult() {
47 $expectedResult = array(
55 'entity_table' => 'civicrm_contribution',
57 'contribution_id' => '',
58 'price_field_id' => '1',
59 'label' => 'line item',
63 'participant_count' => '',
64 'price_field_value_id' => '1',
65 'financial_type_id' => '',
66 'deductible_amount' => '',
72 return $expectedResult;
76 * This example has been generated from the API test suite.
77 * The test that created it is called
80 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/LineItemTest.php
82 * You can see the outcome of the API tests at
83 * https://test.civicrm.org/job/CiviCRM-master-git/
85 * To Learn about the API read
86 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
88 * Browse the api on your own site with the api explorer
89 * http://MYSITE.ORG/path/to/civicrm/api
91 * Read more about testing here
92 * http://wiki.civicrm.org/confluence/display/CRM/Testing
94 * API Standards documentation:
95 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards