3 +--------------------------------------------------------------------+
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2019 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
30 * File for the CRM_Contact_Imports_Parser_ContactTest class.
34 * Test contact import parser.
39 class CRM_Contact_Import_Parser_ContactTest
extends CiviUnitTestCase
{
40 protected $_tablesToTruncate = ['civicrm_address', 'civicrm_phone', 'civicrm_email'];
45 public function setUp() {
50 * Test that import parser will add contact with employee of relationship.
54 public function testImportParserWtihEmployeeOfRelationship() {
55 $this->organizationCreate(array(
56 "organization_name" => "Agileware",
57 "legal_name" => "Agileware",
59 $contactImportValues = array(
60 "first_name" => "Alok",
61 "last_name" => "Patel",
62 "Employee of" => "Agileware",
65 $fields = array_keys($contactImportValues);
66 $values = array_values($contactImportValues);
67 $parser = new CRM_Contact_Import_Parser_Contact($fields, []);
68 $parser->_contactType
= 'Individual';
70 $this->mapRelationshipFields($fields, $parser->getAllFields());
72 $parser = new CRM_Contact_Import_Parser_Contact($fields, [], [], [], array(
84 ), [], [], [], [], []);
86 $parser->_contactType
= 'Individual';
87 $parser->_onDuplicate
= CRM_Import_Parser
::DUPLICATE_UPDATE
;
90 $this->assertEquals(CRM_Import_Parser
::VALID
, $parser->import(CRM_Import_Parser
::DUPLICATE_UPDATE
, $values), 'Return code from parser import was not as expected');
91 $this->callAPISuccess("Contact", "get", array(
92 "first_name" => "Alok",
93 "last_name" => "Patel",
94 "organization_name" => "Agileware",
99 * Test that import parser will not fail when same external_identifier found of deleted contact.
103 public function testImportParserWtihDeletedContactExternalIdentifier() {
104 $contactId = $this->individualCreate(array(
105 "external_identifier" => "ext-1",
107 CRM_Contact_BAO_Contact
::deleteContact($contactId);
108 list($originalValues, $result) = $this->setUpBaseContact(array(
109 'external_identifier' => 'ext-1',
111 $originalValues['nick_name'] = 'Old Bill';
112 $this->runImport($originalValues, CRM_Import_Parser
::DUPLICATE_UPDATE
, CRM_Import_Parser
::VALID
);
113 $originalValues['id'] = $result['id'];
114 $this->assertEquals('ext-1', $this->callAPISuccessGetValue('Contact', array('id' => $result['id'], 'return' => 'external_identifier')));
115 $this->callAPISuccessGetSingle('Contact', $originalValues);
119 * Test import parser will update based on a rule match.
121 * In this case the contact has no external identifier.
125 public function testImportParserWithUpdateWithoutExternalIdentifier() {
126 list($originalValues, $result) = $this->setUpBaseContact();
127 $originalValues['nick_name'] = 'Old Bill';
128 $this->runImport($originalValues, CRM_Import_Parser
::DUPLICATE_UPDATE
, CRM_Import_Parser
::VALID
);
129 $originalValues['id'] = $result['id'];
130 $this->assertEquals('Old Bill', $this->callAPISuccessGetValue('Contact', array('id' => $result['id'], 'return' => 'nick_name')));
131 $this->callAPISuccessGetSingle('Contact', $originalValues);
135 * Test import parser will update contacts with an external identifier.
137 * This is the basic test where the identifier matches the import parameters.
141 public function testImportParserWithUpdateWithExternalIdentifier() {
142 list($originalValues, $result) = $this->setUpBaseContact(array('external_identifier' => 'windows'));
144 $this->assertEquals($result['id'], CRM_Core_DAO
::getFieldValue('CRM_Contact_DAO_Contact', 'windows', 'id', 'external_identifier', TRUE));
145 $this->assertEquals('windows', $result['external_identifier']);
147 $originalValues['nick_name'] = 'Old Bill';
148 $this->runImport($originalValues, CRM_Import_Parser
::DUPLICATE_UPDATE
, CRM_Import_Parser
::VALID
);
149 $originalValues['id'] = $result['id'];
151 $this->assertEquals('Old Bill', $this->callAPISuccessGetValue('Contact', array('id' => $result['id'], 'return' => 'nick_name')));
152 $this->callAPISuccessGetSingle('Contact', $originalValues);
156 * Test import parser will fallback to external identifier.
158 * In this case no primary match exists (e.g the details are not supplied) so it falls back on external identifier.
164 public function testImportParserWithUpdateWithExternalIdentifierButNoPrimaryMatch() {
165 list($originalValues, $result) = $this->setUpBaseContact(array(
166 'external_identifier' => 'windows',
170 $this->assertEquals('windows', $result['external_identifier']);
172 $originalValues['nick_name'] = 'Old Bill';
173 $this->runImport($originalValues, CRM_Import_Parser
::DUPLICATE_UPDATE
, CRM_Import_Parser
::VALID
);
174 $originalValues['id'] = $result['id'];
176 $this->assertEquals('Old Bill', $this->callAPISuccessGetValue('Contact', array('id' => $result['id'], 'return' => 'nick_name')));
177 $this->callAPISuccessGetSingle('Contact', $originalValues);
181 * Test that the import parser adds the external identifier where none is set.
185 public function testImportParserWithUpdateWithNoExternalIdentifier() {
186 list($originalValues, $result) = $this->setUpBaseContact();
187 $originalValues['nick_name'] = 'Old Bill';
188 $originalValues['external_identifier'] = 'windows';
189 $this->runImport($originalValues, CRM_Import_Parser
::DUPLICATE_UPDATE
, CRM_Import_Parser
::VALID
);
190 $originalValues['id'] = $result['id'];
191 $this->assertEquals('Old Bill', $this->callAPISuccessGetValue('Contact', array('id' => $result['id'], 'return' => 'nick_name')));
192 $this->callAPISuccessGetSingle('Contact', $originalValues);
196 * Test that the import parser changes the external identifier when there is a dedupe match.
200 public function testImportParserWithUpdateWithChangedExternalIdentifier() {
201 list($contactValues, $result) = $this->setUpBaseContact(array('external_identifier' => 'windows'));
202 $contact_id = $result['id'];
203 $contactValues['nick_name'] = 'Old Bill';
204 $contactValues['external_identifier'] = 'android';
205 $this->runImport($contactValues, CRM_Import_Parser
::DUPLICATE_UPDATE
, CRM_Import_Parser
::VALID
);
206 $contactValues['id'] = $contact_id;
207 $this->assertEquals('Old Bill', $this->callAPISuccessGetValue('Contact', array('id' => $contact_id, 'return' => 'nick_name')));
208 $this->callAPISuccessGetSingle('Contact', $contactValues);
212 * Test that the import parser adds the address to the right location.
216 public function testImportBillingAddress() {
217 list($contactValues) = $this->setUpBaseContact();
218 $contactValues['nick_name'] = 'Old Bill';
219 $contactValues['external_identifier'] = 'android';
220 $contactValues['street_address'] = 'Big Mansion';
221 $contactValues['phone'] = '911';
222 $this->runImport($contactValues, CRM_Import_Parser
::DUPLICATE_UPDATE
, CRM_Import_Parser
::VALID
, array(0 => NULL, 1 => NULL, 2 => NULL, 3 => NULL, 4 => NULL, 5 => 2, 6 => 2));
223 $address = $this->callAPISuccessGetSingle('Address', array('street_address' => 'Big Mansion'));
224 $this->assertEquals(2, $address['location_type_id']);
226 $phone = $this->callAPISuccessGetSingle('Phone', array('phone' => '911'));
227 $this->assertEquals(2, $phone['location_type_id']);
229 $contact = $this->callAPISuccessGetSingle('Contact', $contactValues);
230 $this->callAPISuccess('Contact', 'delete', array('id' => $contact['id']));
234 * Test that the import parser adds the address to the primary location.
238 public function testImportPrimaryAddress() {
239 list($contactValues) = $this->setUpBaseContact();
240 $contactValues['nick_name'] = 'Old Bill';
241 $contactValues['external_identifier'] = 'android';
242 $contactValues['street_address'] = 'Big Mansion';
243 $contactValues['phone'] = 12334;
244 $this->runImport($contactValues, CRM_Import_Parser
::DUPLICATE_UPDATE
, CRM_Import_Parser
::VALID
, array(0 => NULL, 1 => NULL, 2 => 'Primary', 3 => NULL, 4 => NULL, 5 => 'Primary', 6 => 'Primary'));
245 $address = $this->callAPISuccessGetSingle('Address', array('street_address' => 'Big Mansion'));
246 $this->assertEquals(1, $address['location_type_id']);
247 $this->assertEquals(1, $address['is_primary']);
249 $phone = $this->callAPISuccessGetSingle('Phone', array('phone' => '12334'));
250 $this->assertEquals(1, $phone['location_type_id']);
252 $this->callAPISuccessGetSingle('Email', array('email' => 'bill.gates@microsoft.com'));
254 $contact = $this->callAPISuccessGetSingle('Contact', $contactValues);
255 $this->callAPISuccess('Contact', 'delete', array('id' => $contact['id']));
259 * Test that address custom fields can be imported
261 public function testAddressWithCustomData() {
262 $ids = $this->entityCustomGroupWithSingleFieldCreate('Address', 'AddressTest.php');
263 list($contactValues) = $this->setUpBaseContact();
264 $contactValues['nick_name'] = 'Old Bill';
265 $contactValues['external_identifier'] = 'android';
266 $contactValues['street_address'] = 'Big Mansion';
267 $contactValues['custom_' . $ids['custom_field_id']] = 'Update';
268 $this->runImport($contactValues, CRM_Import_Parser
::DUPLICATE_UPDATE
, CRM_Import_Parser
::VALID
, array(0 => NULL, 1 => NULL, 2 => NULL, 3 => NULL, 4 => NULL, 5 => 'Primary', 6 => 'Primary'));
269 $address = $this->callAPISuccessGetSingle('Address', ['street_address' => 'Big Mansion', 'return' => 'custom_' . $ids['custom_field_id']]);
270 $this->assertEquals('Update', $address['custom_' . $ids['custom_field_id']]);
274 * Test that the import parser adds the address to the primary location.
278 public function testImportDeceased() {
279 list($contactValues) = $this->setUpBaseContact();
280 CRM_Core_Session
::singleton()->set("dateTypes", 1);
281 $contactValues['birth_date'] = '1910-12-17';
282 $contactValues['deceased_date'] = '2010-12-17';
283 $this->runImport($contactValues, CRM_Import_Parser
::DUPLICATE_UPDATE
, CRM_Import_Parser
::VALID
);
284 $contact = $this->callAPISuccessGetSingle('Contact', $contactValues);
285 $this->assertEquals('1910-12-17', $contact['birth_date']);
286 $this->assertEquals('2010-12-17', $contact['deceased_date']);
287 $this->assertEquals(1, $contact['is_deceased']);
288 $this->callAPISuccess('Contact', 'delete', array('id' => $contact['id']));
292 * Test that the import parser adds the address to the primary location.
296 public function testImportTwoAddressFirstPrimary() {
297 list($contactValues) = $this->setUpBaseContact();
298 $contactValues['nick_name'] = 'Old Bill';
299 $contactValues['external_identifier'] = 'android';
300 $contactValues['street_address'] = 'Big Mansion';
301 $contactValues['phone'] = 12334;
302 $fields = array_keys($contactValues);
303 $contactValues['street_address_2'] = 'Teeny Mansion';
304 $contactValues['phone_2'] = 4444;
305 $fields[] = 'street_address';
307 $this->runImport($contactValues, CRM_Import_Parser
::DUPLICATE_UPDATE
, CRM_Import_Parser
::VALID
, array(0 => NULL, 1 => NULL, 2 => NULL, 3 => NULL, 4 => NULL, 5 => 'Primary', 6 => 'Primary', 7 => 3, 8 => 3), $fields);
308 $contact = $this->callAPISuccessGetSingle('Contact', array('external_identifier' => 'android'));
309 $address = $this->callAPISuccess('Address', 'get', array('contact_id' => $contact['id'], 'sequential' => 1));
311 $this->assertEquals(3, $address['values'][0]['location_type_id']);
312 $this->assertEquals(0, $address['values'][0]['is_primary']);
313 $this->assertEquals('Teeny Mansion', $address['values'][0]['street_address']);
315 $this->assertEquals(1, $address['values'][1]['location_type_id']);
316 $this->assertEquals(1, $address['values'][1]['is_primary']);
317 $this->assertEquals('Big Mansion', $address['values'][1]['street_address']);
319 $phone = $this->callAPISuccess('Phone', 'get', array('contact_id' => $contact['id'], 'sequential' => 1));
320 $this->assertEquals(1, $phone['values'][0]['location_type_id']);
321 $this->assertEquals(1, $phone['values'][0]['is_primary']);
322 $this->assertEquals(12334, $phone['values'][0]['phone']);
323 $this->assertEquals(3, $phone['values'][1]['location_type_id']);
324 $this->assertEquals(0, $phone['values'][1]['is_primary']);
325 $this->assertEquals(4444, $phone['values'][1]['phone']);
327 $this->callAPISuccess('Contact', 'delete', array('id' => $contact['id']));
331 * Test that the import parser adds the address to the primary location.
335 public function testImportTwoAddressSecondPrimary() {
336 list($contactValues) = $this->setUpBaseContact();
337 $contactValues['nick_name'] = 'Old Bill';
338 $contactValues['external_identifier'] = 'android';
339 $contactValues['street_address'] = 'Big Mansion';
340 $contactValues['phone'] = 12334;
341 $fields = array_keys($contactValues);
342 $contactValues['street_address_2'] = 'Teeny Mansion';
343 $contactValues['phone_2'] = 4444;
344 $fields[] = 'street_address';
346 $this->runImport($contactValues, CRM_Import_Parser
::DUPLICATE_UPDATE
, CRM_Import_Parser
::VALID
, array(0 => NULL, 1 => NULL, 2 => NULL, 3 => NULL, 4 => NULL, 5 => 3, 6 => 3, 7 => 'Primary', 8 => 'Primary'), $fields);
347 $contact = $this->callAPISuccessGetSingle('Contact', array('external_identifier' => 'android'));
348 $address = $this->callAPISuccess('Address', 'get', array('contact_id' => $contact['id'], 'sequential' => 1))['values'];
350 $this->assertEquals(1, $address[1]['location_type_id']);
351 $this->assertEquals(1, $address[1]['is_primary']);
352 $this->assertEquals('Teeny Mansion', $address[1]['street_address']);
354 $this->assertEquals(3, $address[0]['location_type_id']);
355 $this->assertEquals(0, $address[0]['is_primary']);
356 $this->assertEquals('Big Mansion', $address[0]['street_address']);
358 $phone = $this->callAPISuccess('Phone', 'get', ['contact_id' => $contact['id'], 'sequential' => 1, 'options' => ['sort' => 'is_primary DESC']])['values'];
359 $this->assertEquals(3, $phone[1]['location_type_id']);
360 $this->assertEquals(0, $phone[1]['is_primary']);
361 $this->assertEquals(12334, $phone[1]['phone']);
362 $this->assertEquals(1, $phone[0]['location_type_id']);
363 $this->assertEquals(1, $phone[0]['is_primary']);
364 $this->assertEquals(4444, $phone[0]['phone']);
366 $this->callAPISuccess('Contact', 'delete', array('id' => $contact['id']));
370 * Test that the import parser updates the address on the existing primary location.
374 public function testImportPrimaryAddressUpdate() {
375 list($contactValues) = $this->setUpBaseContact(array('external_identifier' => 'android'));
376 $contactValues['email'] = 'melinda.gates@microsoft.com';
377 $contactValues['phone'] = '98765';
378 $contactValues['external_identifier'] = 'android';
379 $contactValues['street_address'] = 'Big Mansion';
380 $contactValues['city'] = 'Big City';
381 $contactID = $this->callAPISuccessGetValue('Contact', array('external_identifier' => 'android', 'return' => 'id'));
382 $originalAddress = $this->callAPISuccess('Address', 'create', array('location_type_id' => 2, 'street_address' => 'small house', 'contact_id' => $contactID));
383 $originalPhone = $this->callAPISuccess('phone', 'create', array('location_type_id' => 2, 'phone' => '1234', 'contact_id' => $contactID));
384 $this->runImport($contactValues, CRM_Import_Parser
::DUPLICATE_UPDATE
, CRM_Import_Parser
::VALID
, array(0 => NULL, 1 => NULL, 2 => 'Primary', 3 => NULL, 4 => NULL, 5 => 'Primary', 6 => 'Primary', 7 => 'Primary'));
385 $phone = $this->callAPISuccessGetSingle('Phone', ['phone' => '98765']);
386 $this->assertEquals(2, $phone['location_type_id']);
387 $this->assertEquals($originalPhone['id'], $phone['id']);
388 $email = $this->callAPISuccess('Email', 'getsingle', ['contact_id' => $contactID]);
389 $address = $this->callAPISuccessGetSingle('Address', array('street_address' => 'Big Mansion'));
390 $this->assertEquals(2, $address['location_type_id']);
391 $this->assertEquals($originalAddress['id'], $address['id']);
392 $this->assertEquals('Big City', $address['city']);
393 $this->callAPISuccessGetSingle('Contact', $contactValues);
397 * Test the determination of whether a custom field is valid.
399 public function testCustomFieldValidation() {
400 $errorMessage = array();
401 $customGroup = $this->customGroupCreate(array(
402 'extends' => 'Contact',
405 $customField = $this->customFieldOptionValueCreate($customGroup, 'fieldABC', array('html_type' => 'Multi-Select'));
407 'custom_' . $customField['id'] => 'Label1|Label2',
409 CRM_Contact_Import_Parser_Contact
::isErrorInCustomData($params, $errorMessage);
410 $this->assertEquals(array(), $errorMessage);
414 * Test that setting duplicate action to fill doesn't blow away data
415 * that exists, but does fill in where it's empty.
419 public function testImportFill() {
420 // Create a custom field group for testing.
421 $custom_group_name = 'importFillGroup';
422 $results = $this->callAPISuccess('customGroup', 'get', array('title' => $custom_group_name));
423 if ($results['count'] == 0) {
425 'title' => $custom_group_name,
426 'extends' => 'Individual',
429 $customGroup = $this->callAPISuccess('customGroup', 'create', $api_params);
432 // Add two custom fields.
434 'custom_group_id' => $customGroup['id'],
435 'label' => 'importFillField1',
436 'html_type' => 'Select',
437 'data_type' => 'String',
438 'option_values' => array(
443 $result = $this->callAPISuccess('custom_field', 'create', $api_params);
444 $customField1 = $result['id'];
447 'custom_group_id' => $customGroup['id'],
448 'label' => 'importFillField2',
449 'html_type' => 'Select',
450 'data_type' => 'String',
451 'option_values' => array(
456 $result = $this->callAPISuccess('custom_field', 'create', $api_params);
457 $customField2 = $result['id'];
459 // Now set up values.
460 $original_gender = 'Male';
461 $original_custom1 = 'foo';
462 $original_job_title = '';
463 $original_custom2 = '';
464 $original_email = 'test-import-fill@example.org';
466 $import_gender = 'Female';
467 $import_custom1 = 'bar';
468 $import_job_title = 'Chief data importer';
469 $import_custom2 = 'baz';
471 // Create contact with both one known core field and one custom
474 'contact_type' => 'Individual',
475 'email' => $original_email,
476 'gender' => $original_gender,
477 'custom_' . $customField1 => $original_custom1,
479 $result = $this->callAPISuccess('contact', 'create', $api_params);
480 $contact_id = $result['id'];
484 'email' => $original_email,
485 'gender_id' => $import_gender,
486 'custom_' . $customField1 => $import_custom1,
487 'job_title' => $import_job_title,
488 'custom_' . $customField2 => $import_custom2,
491 $this->runImport($import, CRM_Import_Parser
::DUPLICATE_FILL
, CRM_Import_Parser
::VALID
);
494 'gender' => $original_gender,
495 'custom_' . $customField1 => $original_custom1,
496 'job_title' => $import_job_title,
497 'custom_' . $customField2 => $import_custom2,
504 'custom_' . $customField1,
506 'custom_' . $customField2,
509 $result = civicrm_api3('Contact', 'get', $params);
510 $values = array_pop($result['values']);
511 foreach ($expected as $field => $expected_value) {
512 if (!isset($values[$field])) {
516 $given_value = $values[$field];
520 // job_title: Chief Data Importer
521 // importFillField1: foo
522 // importFillField2: baz
523 $this->assertEquals($expected_value, $given_value, "$field properly handled during Fill import");
528 * CRM-19888 default country should be used if ambigous.
530 public function testImportAmbiguousStateCountry() {
531 $this->callAPISuccess('Setting', 'create', ['defaultContactCountry' => 1228]);
532 $countries = CRM_Core_PseudoConstant
::country(FALSE, FALSE);
533 $this->callAPISuccess('Setting', 'create', array('countryLimit' => array(array_search('United States', $countries), array_search('Guyana', $countries), array_search('Netherlands', $countries))));
534 $this->callAPISuccess('Setting', 'create', array('provinceLimit' => array(array_search('United States', $countries), array_search('Guyana', $countries), array_search('Netherlands', $countries))));
535 $mapper = array(0 => NULL, 1 => NULL, 2 => 'Primary', 3 => NULL);
536 list($contactValues) = $this->setUpBaseContact();
537 $fields = array_keys($contactValues);
538 $addressValues = array(
539 'street_address' => 'PO Box 2716',
541 'state_province' => 'UT',
542 'postal_code' => 84049,
543 'country' => 'United States',
545 $locationTypes = $this->callAPISuccess('Address', 'getoptions', array('field' => 'location_type_id'));
546 $locationTypes = $locationTypes['values'];
547 foreach ($addressValues as $field => $value) {
548 $contactValues['home_' . $field] = $value;
549 $mapper[] = array_search('Home', $locationTypes);
550 $contactValues['work_' . $field] = $value;
551 $mapper[] = array_search('Work', $locationTypes);
555 $contactValues['work_country'] = '';
557 $this->runImport($contactValues, CRM_Import_Parser
::DUPLICATE_UPDATE
, CRM_Import_Parser
::VALID
, $mapper, $fields);
558 $addresses = $this->callAPISuccess('Address', 'get', array('contact_id' => array('>' => 2), 'sequential' => 1));
559 $this->assertEquals(2, $addresses['count']);
560 $this->assertEquals(array_search('United States', $countries), $addresses['values'][0]['country_id']);
561 $this->assertEquals(array_search('United States', $countries), $addresses['values'][1]['country_id']);
565 * Run the import parser.
567 * @param array $originalValues
569 * @param int $onDuplicateAction
570 * @param int $expectedResult
571 * @param array|null $mapperLocType
572 * Array of location types that map to the input arrays.
573 * @param array|null $fields
574 * Array of field names. Will be calculated from $originalValues if not passed in, but
575 * that method does not cope with duplicates.
577 protected function runImport($originalValues, $onDuplicateAction, $expectedResult, $mapperLocType = [], $fields = NULL) {
579 $fields = array_keys($originalValues);
581 $values = array_values($originalValues);
582 $parser = new CRM_Contact_Import_Parser_Contact($fields, $mapperLocType);
583 $parser->_contactType
= 'Individual';
584 $parser->_onDuplicate
= $onDuplicateAction;
586 $this->assertEquals($expectedResult, $parser->import($onDuplicateAction, $values), 'Return code from parser import was not as expected');
590 * @param array $fields Array of fields to be imported
591 * @param array $allfields Array of all fields which can be part of import
593 private function mapRelationshipFields(&$fields, $allfields) {
594 foreach ($allfields as $key => $fieldtocheck) {
595 $elementIndex = array_search($fieldtocheck->_title
, $fields);
596 if ($elementIndex !== FALSE) {
597 $fields[$elementIndex] = $key;
603 * Set up the underlying contact.
605 * @param array $params
606 * Optional extra parameters to set.
611 protected function setUpBaseContact($params = array()) {
612 $originalValues = array_merge(array(
613 'first_name' => 'Bill',
614 'last_name' => 'Gates',
615 'email' => 'bill.gates@microsoft.com',
616 'nick_name' => 'Billy-boy',
618 $this->runImport($originalValues, CRM_Import_Parser
::DUPLICATE_UPDATE
, CRM_Import_Parser
::VALID
);
619 $result = $this->callAPISuccessGetSingle('Contact', $originalValues);
620 return array($originalValues, $result);