update test generated examples
[civicrm-core.git] / api / v3 / examples / LineItemCreate.php
1 <?php
2
3 /*
4
5 */
6 function line_item_create_example(){
7 $params = array(
8 'version' => 3,
9 'price_field_value_id' => 1,
10 'price_field_id' => 1,
11 'entity_table' => 'civicrm_contribution',
12 'entity_id' => 1,
13 'qty' => 1,
14 'unit_price' => 50,
15 'line_total' => 50,
16 );
17
18 $result = civicrm_api( 'line_item','create',$params );
19
20 return $result;
21 }
22
23 /*
24 * Function returns array of result expected from previous function
25 */
26 function line_item_create_expectedresult(){
27
28 $expectedResult = array(
29 'is_error' => 0,
30 'undefined_fields' => array(
31 '0' => 'label',
32 '1' => 'price_field_value_id',
33 '2' => 'price_field_id',
34 '3' => 'entity_table',
35 '4' => 'entity_id',
36 '5' => 'qty',
37 '6' => 'unit_price',
38 '7' => 'line_total',
39 ),
40 'version' => 3,
41 'count' => 1,
42 'id' => 1,
43 'values' => array(
44 '1' => array(
45 'id' => '1',
46 'entity_table' => 'civicrm_contribution',
47 'entity_id' => '1',
48 'price_field_id' => '1',
49 'label' => 'line item',
50 'qty' => '1',
51 'unit_price' => '50',
52 'line_total' => '50',
53 'participant_count' => '',
54 'price_field_value_id' => '1',
55 'financial_type_id' => '',
56 'deductible_amount' => '',
57 ),
58 ),
59 'xdebug' => array(
60 'peakMemory' => 144948640,
61 'memory' => 131358352,
62 'timeIndex' => '1877.7615101337',
63 ),
64 );
65
66 return $expectedResult ;
67 }
68
69
70 /*
71 * This example has been generated from the API test suite. The test that created it is called
72 *
73 * testCreateLineItem and can be found in
74 * http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/LineItemTest.php
75 *
76 * You can see the outcome of the API tests at
77 * http://tests.dev.civicrm.org/trunk/results-api_v3
78 *
79 * To Learn about the API read
80 * http://book.civicrm.org/developer/current/techniques/api/
81 *
82 * and review the wiki at
83 * http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs
84 *
85 * Read more about testing here
86 * http://wiki.civicrm.org/confluence/display/CRM/Testing
87 *
88 * API Standards documentation:
89 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
90 */