3 * Test Generated example of using line_item create API.
8 function line_item_create_example() {
10 'price_field_value_id' => 1,
11 'price_field_id' => 1,
12 'entity_table' => 'civicrm_contribution',
21 $result = civicrm_api3('line_item', 'create', $params);
23 catch (CiviCRM_API3_Exception
$e) {
25 $errorMessage = $e->getMessage();
26 $errorCode = $e->getErrorCode();
27 $errorData = $e->getExtraParams();
29 'error' => $errorMessage,
30 'error_code' => $errorCode,
31 'error_data' => $errorData,
39 * Function returns array of result expected from previous function.
44 function line_item_create_expectedresult() {
46 $expectedResult = array(
54 'entity_table' => 'civicrm_contribution',
56 'contribution_id' => '',
57 'price_field_id' => '1',
58 'label' => 'line item',
62 'participant_count' => '',
63 'price_field_value_id' => '1',
64 'financial_type_id' => '',
65 'deductible_amount' => '',
71 return $expectedResult;
75 * This example has been generated from the API test suite.
76 * The test that created it is called
79 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/LineItemTest.php
81 * You can see the outcome of the API tests at
82 * https://test.civicrm.org/job/CiviCRM-master-git/
84 * To Learn about the API read
85 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
87 * Browse the api on your own site with the api explorer
88 * http://MYSITE.ORG/path/to/civicrm/api
90 * Read more about testing here
91 * http://wiki.civicrm.org/confluence/display/CRM/Testing
93 * API Standards documentation:
94 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards