From be2db20554fccfc36d342bab1572f4748989fd77 Mon Sep 17 00:00:00 2001 From: eileen Date: Fri, 12 Apr 2019 16:06:17 +1000 Subject: [PATCH] Add unit test to ensure address custom data is imported --- .../CRM/Contact/Import/Parser/ContactTest.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/phpunit/CRM/Contact/Import/Parser/ContactTest.php b/tests/phpunit/CRM/Contact/Import/Parser/ContactTest.php index f6a4598d32..823b91aa2c 100644 --- a/tests/phpunit/CRM/Contact/Import/Parser/ContactTest.php +++ b/tests/phpunit/CRM/Contact/Import/Parser/ContactTest.php @@ -254,6 +254,21 @@ class CRM_Contact_Import_Parser_ContactTest extends CiviUnitTestCase { $this->callAPISuccess('Contact', 'delete', array('id' => $contact['id'])); } + /** + * Test that address custom fields can be imported + */ + public function testAddressWithCustomData() { + $ids = $this->entityCustomGroupWithSingleFieldCreate('Address', 'AddressTest.php'); + list($contactValues) = $this->setUpBaseContact(); + $contactValues['nick_name'] = 'Old Bill'; + $contactValues['external_identifier'] = 'android'; + $contactValues['street_address'] = 'Big Mansion'; + $contactValues['custom_' . $ids['custom_field_id']] = 'Update'; + $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')); + $address = $this->callAPISuccessGetSingle('Address', ['street_address' => 'Big Mansion', 'return' => 'custom_' . $ids['custom_field_id']]); + $this->assertEquals('Update', $address['custom_' . $ids['custom_field_id']]); + } + /** * Test that the import parser adds the address to the primary location. * -- 2.25.1