Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
CiviCRM Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Development
CiviCRM Core
Commits
74b824c6
Unverified
Commit
74b824c6
authored
2 years ago
by
Eileen McNaughton
Committed by
GitHub
2 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #23562 from eileenmcnaughton/import_cc
Additional test
parents
12f6fcae
1576627e
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/phpunit/CRM/Contact/Import/Parser/ContactTest.php
+54
-0
54 additions, 0 deletions
tests/phpunit/CRM/Contact/Import/Parser/ContactTest.php
with
54 additions
and
0 deletions
tests/phpunit/CRM/Contact/Import/Parser/ContactTest.php
+
54
−
0
View file @
74b824c6
...
...
@@ -1601,6 +1601,60 @@ class CRM_Contact_Import_Parser_ContactTest extends CiviUnitTestCase {
],
$params
);
}
/**
* Test that import parser will not match the imported primary to
* an existing contact via the related contacts fields.
*
* Currently fails because CRM_Dedupe_Finder::formatParams($input, $contactType);
* called in getDuplicateContacts flattens the contact array adding the
* related contacts values to the primary contact.
*
* https://github.com/civicrm/civicrm-core/blob/ca13ec46eae2042604e4e106c6cb3dc0439db3e2/CRM/Dedupe/Finder.php#L238
*
* @throws \API_Exception
* @throws \CRM_Core_Exception
* @throws \CiviCRM_API3_Exception
* @throws \Civi\API\Exception\UnauthorizedException
*/
public
function
testImportParserDoesNotMatchPrimaryToRelated
():
void
{
$this
->
individualCreate
([
'first_name'
=>
'Bob'
,
'last_name'
=>
'Dobbs'
,
'email'
=>
'tim.cook@apple.com'
,
]);
$contactImportValues
=
[
'first_name'
=>
'Alok'
,
'last_name'
=>
'Patel'
,
'Employee of'
=>
'email'
,
];
$mapper
=
[
[
'first_name'
],
[
'last_name'
],
[
'5_a_b'
,
'email'
],
];
$fields
=
array_keys
(
$contactImportValues
);
$values
=
array_values
(
$contactImportValues
);
$values
[]
=
'tim.cook@apple.com'
;
$userJobID
=
$this
->
getUserJobID
([
'mapper'
=>
$mapper
,
'onDuplicate'
=>
CRM_Import_Parser
::
DUPLICATE_UPDATE
,
]);
$parser
=
new
CRM_Contact_Import_Parser_Contact
(
$fields
);
$parser
->
setUserJobID
(
$userJobID
);
$parser
->
init
();
$this
->
assertEquals
(
CRM_Import_Parser
::
ERROR
,
$parser
->
import
(
CRM_Import_Parser
::
DUPLICATE_UPDATE
,
$values
),
'Return code from parser import was not as expected'
);
$this
->
callAPISuccessGetSingle
(
'Contact'
,
[
'first_name'
=>
'Bob'
,
'last_name'
=>
'Dobbs'
,
'email'
=>
'tim.cook@apple.com'
,
]);
}
/**
* Set up the underlying contact.
*
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment