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
da0c54be
Commit
da0c54be
authored
3 years ago
by
Eileen McNaughton
Browse files
Options
Downloads
Patches
Plain Diff
#2656
Add test to demonstrate issue / bug
Fix enotice in test Why didn't this cause it to fail before
parent
93aadf0f
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/phpunit/CRM/Dedupe/MergerTest.php
+49
-0
49 additions, 0 deletions
tests/phpunit/CRM/Dedupe/MergerTest.php
tests/phpunit/CRM/Member/BAO/MembershipTest.php
+0
-5
0 additions, 5 deletions
tests/phpunit/CRM/Member/BAO/MembershipTest.php
with
49 additions
and
5 deletions
tests/phpunit/CRM/Dedupe/MergerTest.php
+
49
−
0
View file @
da0c54be
...
...
@@ -32,6 +32,13 @@ class CRM_Dedupe_MergerTest extends CiviUnitTestCase {
'civicrm_group'
,
'civicrm_prevnext_cache'
,
]);
if
(
$this
->
hookClass
)
{
// Do this here to flush the entityTables cache on teardown.
// it might be a bit expensive to add to every single test
// so a bit selectively.
$this
->
hookClass
->
reset
();
CRM_Core_DAO_AllCoreTables
::
reinitializeCache
(
TRUE
);
}
parent
::
tearDown
();
}
...
...
@@ -1449,4 +1456,46 @@ WHERE
return
$cidRefs
;
}
/**
* Test that declaring a custom join for search kit does not break merge.
*
* @throws \CRM_Core_Exception
*/
public
function
testMergeWithDeclaredSearchJoin
():
void
{
$this
->
hookClass
->
setHook
(
'civicrm_entityTypes'
,
[
$this
,
'hookEntityTypes'
,
]);
CRM_Core_DAO_AllCoreTables
::
reinitializeCache
(
TRUE
);
$contact1
=
$this
->
individualCreate
();
$contact2
=
$this
->
individualCreate
([
'api.Im.create'
=>
[
'name'
=>
'chat_handle'
]]);
$this
->
callAPISuccess
(
'Contact'
,
'merge'
,
[
'to_keep_id'
=>
$contact1
,
'to_remove_id'
=>
$contact2
]);
}
/**
* Implements hook_civicrm_entityTypes().
*
* Declare a callback to hookLinkCallBack function.
*/
public
function
hookEntityTypes
(
&
$entityTypes
)
:
void
{
$entityTypes
[
'CRM_Core_DAO_IM'
][
'links_callback'
][]
=
[
$this
,
'hookLinkCallBack'
];
}
/**
* Callback to alter the link to im
*
* Declare a pseudo-fk between name and IM.name
* so it can be joined in SearchKit. This is obviously
* artificial but is intended to mimic the pseudo-joins
* extensions might use to leverage search kit.
*
* @param string $className
* @param array $links
*
* @noinspection PhpUnusedParameterInspection
*/
public
function
hookLinkCallBack
(
string
$className
,
array
&
$links
):
void
{
$links
[]
=
new
CRM_Core_Reference_Basic
(
'civicrm_im'
,
'name'
,
'civicrm_contact'
,
'first_name'
);
}
}
This diff is collapsed.
Click to expand it.
tests/phpunit/CRM/Member/BAO/MembershipTest.php
+
0
−
5
View file @
da0c54be
...
...
@@ -40,7 +40,6 @@ class CRM_Member_BAO_MembershipTest extends CiviUnitTestCase {
* @throws \CiviCRM_API3_Exception
*/
public
function
tearDown
():
void
{
$this
->
membershipStatusDelete
(
$this
->
_membershipStatusID
);
$this
->
_membershipStatusID
=
$this
->
_membershipTypeID
=
NULL
;
$this
->
quickCleanUpFinancialEntities
();
parent
::
tearDown
();
...
...
@@ -906,10 +905,6 @@ class CRM_Member_BAO_MembershipTest extends CiviUnitTestCase {
$this
->
assertEquals
(
2
,
$relatedMembershipsCount
,
"Related membership count should still be 2, but found
$relatedMembershipsCount
"
);
$this
->
assertMembershipExists
(
$relatedMembership1
[
'id'
]);
$this
->
assertMembershipExists
(
$relatedMembership2
[
'id'
]);
// Clean up: Delete everything!
$this
->
membershipDelete
(
$membership
[
'id'
]);
$this
->
membershipStatusDelete
(
$otherStatusID
);
}
public
function
testRelatedMembershipWithContactReferenceCustomField
()
{
...
...
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