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
50efb875
Unverified
Commit
50efb875
authored
5 years ago
by
JonGold
Browse files
Options
Downloads
Patches
Plain Diff
mailing#60: Fix regression where multiple bulk recipient option isn't respected
test fixes
parent
a80b5584
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
CRM/Mailing/BAO/Recipients.php
+1
-1
1 addition, 1 deletion
CRM/Mailing/BAO/Recipients.php
tests/phpunit/api/v3/JobProcessMailingTest.php
+32
-0
32 additions, 0 deletions
tests/phpunit/api/v3/JobProcessMailingTest.php
with
33 additions
and
1 deletion
CRM/Mailing/BAO/Recipients.php
+
1
−
1
View file @
50efb875
...
...
@@ -64,7 +64,7 @@ WHERE mailing_id = %1
// if any email is marked on_hold =1 or contact is deceased after mailing is submitted
// then it should be get skipped while preparing event_queue
// event_queue list is prepared when mailing job gets started.
$additionalJoin
=
" INNER JOIN civicrm_email e ON (r.email_id = e.id AND e.on_hold = 0
AND e.is_primary = 1
)
$additionalJoin
=
" INNER JOIN civicrm_email e ON (r.email_id = e.id AND e.on_hold = 0)
INNER JOIN civicrm_contact c on (c.id = r.contact_id AND c.is_deceased <> 1 AND c.do_not_email = 0 AND c.is_opt_out = 0)
"
;
}
...
...
This diff is collapsed.
Click to expand it.
tests/phpunit/api/v3/JobProcessMailingTest.php
+
32
−
0
View file @
50efb875
...
...
@@ -127,6 +127,38 @@ class api_v3_JobProcessMailingTest extends CiviUnitTestCase {
}
/**
* Test that "multiple bulk email recipients" setting is respected.
*/
public
function
testMultipleBulkRecipients
()
{
Civi
::
settings
()
->
add
([
'civimail_multiple_bulk_emails'
=>
1
,
]);
$contactID
=
$this
->
individualCreate
([
'first_name'
=>
'test recipient'
]);
$email1
=
$this
->
callAPISuccess
(
'email'
,
'create'
,
[
'contact_id'
=>
$contactID
,
'email'
=>
'mail1@example.org'
,
'is_bulkmail'
=>
1
,
]);
$email2
=
$this
->
callAPISuccess
(
'email'
,
'create'
,
[
'contact_id'
=>
$contactID
,
'email'
=>
'mail2@example.org'
,
'is_bulkmail'
=>
1
,
]);
$this
->
callAPISuccess
(
'group_contact'
,
'create'
,
[
'contact_id'
=>
$contactID
,
'group_id'
=>
$this
->
_groupID
,
'status'
=>
'Added'
,
]);
$mailing
=
$this
->
callAPISuccess
(
'mailing'
,
'create'
,
$this
->
_params
);
$this
->
assertEquals
(
2
,
$this
->
callAPISuccess
(
'MailingRecipients'
,
'get'
,
[
'mailing_id'
=>
$mailing
[
'id'
]])[
'count'
]);
$this
->
callAPISuccess
(
'job'
,
'process_mailing'
,
[]);
$this
->
_mut
->
assertRecipients
([[
'mail1@example.org'
],
[
'mail2@example.org'
]]);
// Don't leave data lying around for other tests to screw up on.
$this
->
callAPISuccess
(
'Email'
,
'delete'
,
[
'id'
=>
$email1
[
'id'
]]);
$this
->
callAPISuccess
(
'Email'
,
'delete'
,
[
'id'
=>
$email2
[
'id'
]]);
}
/**
* Test pause and resume on Mailing.
*/
...
...
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