/**
* Test that import parser will add contact with employee of relationship.
- *
- * @throws \Exception
*/
- public function testImportParserWtihEmployeeOfRelationship() {
+ public function testImportParserWithEmployeeOfRelationship(): void {
$this->organizationCreate([
- "organization_name" => "Agileware",
- "legal_name" => "Agileware",
+ 'organization_name' => 'Agileware',
+ 'legal_name' => 'Agileware',
]);
$contactImportValues = [
"first_name" => "Alok",
* @throws \Exception
*/
public function testImportParserWithUpdateWithExternalIdentifier() {
- list($originalValues, $result) = $this->setUpBaseContact(['external_identifier' => 'windows']);
+ [$originalValues, $result] = $this->setUpBaseContact(['external_identifier' => 'windows']);
$this->assertEquals($result['id'], CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', 'windows', 'id', 'external_identifier', TRUE));
$this->assertEquals('windows', $result['external_identifier']);
* @throws \Exception
*/
public function testImportParserWithUpdateWithExternalIdentifierButNoPrimaryMatch() {
- list($originalValues, $result) = $this->setUpBaseContact([
+ [$originalValues, $result] = $this->setUpBaseContact([
'external_identifier' => 'windows',
'email' => NULL,
]);
* @throws \Exception
*/
public function testImportParserWithUpdateWithContactID() {
- list($originalValues, $result) = $this->setUpBaseContact([
+ [$originalValues, $result] = $this->setUpBaseContact([
'external_identifier' => '',
'email' => NULL,
]);
* @throws \Exception
*/
public function testImportParserWithUpdateWithNoExternalIdentifier() {
- list($originalValues, $result) = $this->setUpBaseContact();
+ [$originalValues, $result] = $this->setUpBaseContact();
$originalValues['nick_name'] = 'Old Bill';
$originalValues['external_identifier'] = 'windows';
$this->runImport($originalValues, CRM_Import_Parser::DUPLICATE_UPDATE, CRM_Import_Parser::VALID);
* @throws \Exception
*/
public function testImportParserWithUpdateWithChangedExternalIdentifier() {
- list($contactValues, $result) = $this->setUpBaseContact(['external_identifier' => 'windows']);
+ [$contactValues, $result] = $this->setUpBaseContact(['external_identifier' => 'windows']);
$contact_id = $result['id'];
$contactValues['nick_name'] = 'Old Bill';
$contactValues['external_identifier'] = 'android';
* @throws \Exception
*/
public function testImportBillingAddress() {
- list($contactValues) = $this->setUpBaseContact();
+ [$contactValues] = $this->setUpBaseContact();
$contactValues['nick_name'] = 'Old Bill';
$contactValues['external_identifier'] = 'android';
$contactValues['street_address'] = 'Big Mansion';
* @throws \Exception
*/
public function testImportPrimaryAddress() {
- list($contactValues) = $this->setUpBaseContact();
+ [$contactValues] = $this->setUpBaseContact();
$contactValues['nick_name'] = 'Old Bill';
$contactValues['external_identifier'] = 'android';
$contactValues['street_address'] = 'Big Mansion';
*/
public function testAddressWithCustomData() {
$ids = $this->entityCustomGroupWithSingleFieldCreate('Address', 'AddressTest.php');
- list($contactValues) = $this->setUpBaseContact();
+ [$contactValues] = $this->setUpBaseContact();
$contactValues['nick_name'] = 'Old Bill';
$contactValues['external_identifier'] = 'android';
$contactValues['street_address'] = 'Big Mansion';
$this->assertEquals('Y', $contact[$this->getCustomFieldName('select')]);
}
+ /**
+ * Test importing in the Preferred Language Field
+ *
+ * @throws \CRM_Core_Exception
+ */
+ public function testPreferredLanguageImport() {
+ $contactValues = [
+ 'first_name' => 'Bill',
+ 'last_name' => 'Gates',
+ 'email' => 'bill.gates@microsoft.com',
+ 'nick_name' => 'Billy-boy',
+ 'preferred_language' => 'English (Australia)',
+ ];
+ $this->runImport($contactValues, CRM_Import_Parser::DUPLICATE_UPDATE, CRM_Import_Parser::VALID, [NULL, NULL, 'Primary', NULL, NULL]);
+ }
+
/**
* Test that the import parser adds the address to the primary location.
*
* @throws \Exception
*/
public function testImportDeceased() {
- list($contactValues) = $this->setUpBaseContact();
+ [$contactValues] = $this->setUpBaseContact();
CRM_Core_Session::singleton()->set("dateTypes", 1);
$contactValues['birth_date'] = '1910-12-17';
$contactValues['deceased_date'] = '2010-12-17';
* @throws \Exception
*/
public function testImportTwoAddressFirstPrimary() {
- list($contactValues) = $this->setUpBaseContact();
+ [$contactValues] = $this->setUpBaseContact();
$contactValues['nick_name'] = 'Old Bill';
$contactValues['external_identifier'] = 'android';
$contactValues['street_address'] = 'Big Mansion';
* @throws \Exception
*/
public function testImportTwoAddressSecondPrimary() {
- list($contactValues) = $this->setUpBaseContact();
+ [$contactValues] = $this->setUpBaseContact();
$contactValues['nick_name'] = 'Old Bill';
$contactValues['external_identifier'] = 'android';
$contactValues['street_address'] = 'Big Mansion';
* @throws \Exception
*/
public function testImportPrimaryAddressUpdate() {
- list($contactValues) = $this->setUpBaseContact(['external_identifier' => 'android']);
+ [$contactValues] = $this->setUpBaseContact(['external_identifier' => 'android']);
$contactValues['email'] = 'melinda.gates@microsoft.com';
$contactValues['phone'] = '98765';
$contactValues['external_identifier'] = 'android';
* that method does not cope with duplicates.
* @param int|null $ruleGroupId
* To test against a specific dedupe rule group, pass its ID as this argument.
+ *
+ * @throws \CRM_Core_Exception
+ * @throws \CiviCRM_API3_Exception
*/
- protected function runImport($originalValues, $onDuplicateAction, $expectedResult, $mapperLocType = [], $fields = NULL, int $ruleGroupId = NULL) {
+ protected function runImport(array $originalValues, $onDuplicateAction, $expectedResult, $mapperLocType = [], $fields = NULL, int $ruleGroupId = NULL): void {
if (!$fields) {
$fields = array_keys($originalValues);
}