4 test demonstrates the syntax to create 2 chained entities
6 function contact_create_example(){
8 'first_name' => 'abc3',
10 'contact_type' => 'Individual',
11 'email' => 'man3@yahoo.com',
13 'api.contribution.create' => array(
14 'receive_date' => '2010-01-01',
15 'total_amount' => '100',
16 'financial_type_id' => 1,
17 'payment_instrument_id' => 1,
18 'non_deductible_amount' => '10',
22 'invoice_id' => 67990,
24 'contribution_status_id' => 1,
26 'api.website.create' => array(
27 'url' => 'http://civicrm.org',
29 'api.website.create.2' => array(
30 'url' => 'http://chained.org',
34 $result = civicrm_api( 'contact','create',$params );
40 * Function returns array of result expected from previous function
42 function contact_create_expectedresult(){
44 $expectedResult = array(
52 'contact_type' => 'Individual',
53 'contact_sub_type' => '',
60 'legal_identifier' => '',
61 'external_identifier' => '',
62 'sort_name' => 'xyz3, abc3',
63 'display_name' => 'abc3 xyz3',
67 'preferred_communication_method' => '',
68 'preferred_language' => 'en_US',
69 'preferred_mail_format' => 'Both',
70 'hash' => '67eac7789eaee00',
72 'first_name' => 'abc3',
74 'last_name' => 'xyz3',
77 'email_greeting_id' => '1',
78 'email_greeting_custom' => '',
79 'email_greeting_display' => '',
80 'postal_greeting_id' => '1',
81 'postal_greeting_custom' => '',
82 'postal_greeting_display' => '',
83 'addressee_id' => '1',
84 'addressee_custom' => '',
85 'addressee_display' => '',
90 'deceased_date' => '',
91 'household_name' => '',
92 'primary_contact_id' => '',
93 'organization_name' => '',
95 'user_unique_id' => '',
96 'created_date' => '20120130621222105',
97 'modified_date' => '2012-11-14 16:02:35',
98 'api.contribution.create' => array(
107 'financial_type_id' => '1',
108 'contribution_page_id' => '',
109 'payment_instrument_id' => '1',
110 'receive_date' => '20100101000000',
111 'non_deductible_amount' => '10',
112 'total_amount' => '100',
113 'fee_amount' => '50',
114 'net_amount' => '90',
115 'trxn_id' => '15345',
116 'invoice_id' => '67990',
119 'cancel_reason' => '',
120 'receipt_date' => '',
121 'thankyou_date' => '',
123 'amount_level' => '',
124 'contribution_recur_id' => '',
125 'honor_contact_id' => '',
127 'is_pay_later' => '',
128 'contribution_status_id' => '1',
129 'honor_type_id' => '',
131 'check_number' => 'null',
133 'contribution_type_id' => '1',
137 'api.website.create' => array(
146 'url' => 'http://civicrm.org',
147 'website_type_id' => '',
151 'api.website.create.2' => array(
160 'url' => 'http://chained.org',
161 'website_type_id' => '',
169 return $expectedResult ;
174 * This example has been generated from the API test suite. The test that created it is called
176 * testCreateIndividualWithContributionDottedSyntax and can be found in
177 * http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/ContactTest.php
179 * You can see the outcome of the API tests at
180 * http://tests.dev.civicrm.org/trunk/results-api_v3
182 * To Learn about the API read
183 * http://book.civicrm.org/developer/current/techniques/api/
185 * and review the wiki at
186 * http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs
188 * Read more about testing here
189 * http://wiki.civicrm.org/confluence/display/CRM/Testing
191 * API Standards documentation:
192 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards