4 example demonstrates use of Replace in a nested API call
6 function email_replace_example(){
10 'api.email.replace' => array(
13 'location_type_id' => 20,
14 'email' => '1-1@example.com',
18 'location_type_id' => 20,
19 'email' => '1-2@example.com',
23 'location_type_id' => 20,
24 'email' => '1-3@example.com',
28 'location_type_id' => 21,
29 'email' => '2-1@example.com',
33 'location_type_id' => 21,
34 'email' => '2-2@example.com',
41 $result = civicrm_api( 'email','replace',$params );
47 * Function returns array of result expected from previous function
49 function email_replace_expectedresult(){
51 $expectedResult = array(
59 'contact_type' => 'Organization',
60 'contact_sub_type' => '',
61 'sort_name' => 'Unit Test Organization',
62 'display_name' => 'Unit Test Organization',
69 'legal_identifier' => '',
70 'external_identifier' => '',
74 'preferred_mail_format' => 'Both',
81 'deceased_date' => '',
82 'household_name' => '',
83 'organization_name' => 'Unit Test Organization',
85 'contact_is_deleted' => 0,
86 'current_employer' => '',
88 'street_address' => '',
89 'supplemental_address_1' => '',
90 'supplemental_address_2' => '',
92 'postal_code_suffix' => '',
96 'state_province_id' => '',
97 'state_province_name' => '',
98 'state_province' => '',
102 'phone_type_id' => '',
110 'worldregion_id' => '',
111 'world_region' => '',
113 'api.email.replace' => array(
120 'contact_id' => '10',
121 'location_type_id' => '20',
122 'email' => '1-1@example.com',
129 'signature_text' => '',
130 'signature_html' => '',
134 'contact_id' => '10',
135 'location_type_id' => '20',
136 'email' => '1-2@example.com',
143 'signature_text' => '',
144 'signature_html' => '',
148 'contact_id' => '10',
149 'location_type_id' => '20',
150 'email' => '1-3@example.com',
157 'signature_text' => '',
158 'signature_html' => '',
162 'contact_id' => '10',
163 'location_type_id' => '21',
164 'email' => '2-1@example.com',
171 'signature_text' => '',
172 'signature_html' => '',
176 'contact_id' => '10',
177 'location_type_id' => '21',
178 'email' => '2-2@example.com',
185 'signature_text' => '',
186 'signature_html' => '',
194 return $expectedResult ;
199 * This example has been generated from the API test suite. The test that created it is called
201 * testReplaceEmailsInChain and can be found in
202 * http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/EmailTest.php
204 * You can see the outcome of the API tests at
205 * http://tests.dev.civicrm.org/trunk/results-api_v3
207 * To Learn about the API read
208 * http://book.civicrm.org/developer/current/techniques/api/
210 * and review the wiki at
211 * http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs
213 * Read more about testing here
214 * http://wiki.civicrm.org/confluence/display/CRM/Testing
216 * API Standards documentation:
217 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards