3 * Test Generated example of using line_item create API
6 function line_item_create_example(){
8 'price_field_value_id' => 1,
10 'entity_table' => 'civicrm_contribution',
19 $result = civicrm_api3('line_item', 'create', $params);
21 catch (CiviCRM_API3_Exception
$e) {
23 $errorMessage = $e->getMessage();
24 $errorCode = $e->getErrorCode();
25 $errorData = $e->getExtraParams();
26 return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData);
33 * Function returns array of result expected from previous function
35 function line_item_create_expectedresult(){
37 $expectedResult = array(
45 'entity_table' => 'civicrm_contribution',
47 'price_field_id' => '1',
48 'label' => 'line item',
52 'participant_count' => '',
53 'price_field_value_id' => '1',
54 'financial_type_id' => '',
55 'deductible_amount' => '',
60 return $expectedResult;
65 * This example has been generated from the API test suite. The test that created it is called
67 * testCreateLineItem and can be found in
68 * http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/LineItemTest.php
70 * You can see the outcome of the API tests at
71 * http://tests.dev.civicrm.org/trunk/results-api_v3
73 * To Learn about the API read
74 * http://book.civicrm.org/developer/current/techniques/api/
76 * and review the wiki at
77 * http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs
79 * Read more about testing here
80 * http://wiki.civicrm.org/confluence/display/CRM/Testing
82 * API Standards documentation:
83 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards