Skip to content

Commit

Permalink
Merge pull request #32193 from civicrm/6.0
Browse files Browse the repository at this point in the history
6.0 to master
  • Loading branch information
eileenmcnaughton authored Feb 22, 2025
2 parents 0b45244 + f16bef7 commit 55aa3ea
Showing 1 changed file with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,33 +71,39 @@ public function testBirthdayMessage():void {
'body_html' => '<p>Your birthday is tomorrow!</p>',
'subject' => 'Happy birthday {contact.first_name}!',
]);
$this->assertCronRuns([
$yearToUse = date('Y') + 1;
$cronRuns = [
[
// No birthdays tomorrow
'time' => '2025-04-02 04:00:00',
'time' => $yearToUse . '-04-02 04:00:00',
'to' => [],
'subjects' => [],
],
[
'time' => '2025-02-18 04:00:00',
'time' => $yearToUse . '-02-18 04:00:00',
'to' => [["b@$lastName"]],
'all_recipients' => ["b@$lastName;alt1@$lastName"],
'subjects' => ['Happy birthday B!'],
],
[
// Upcoming birthday but contact is deceased
'time' => '2025-02-08 04:00:00',
'time' => $yearToUse . '-02-08 04:00:00',
'to' => [],
'subjects' => [],
],
[
];
// We can only run this case if the current year is a leap year.
// CRM_Utils_Time doesn't change what mysql CURDATE returns, so it will fail.
if ((new \IntlGregorianCalendar())->isLeapYear(date('Y'))) {
$cronRuns[] = [
// On a non-leap-year, birthday is the 28th
'time' => '2025-02-27 04:00:00',
'time' => $yearToUse . '-02-27 04:00:00',
'to' => [["a@$lastName"], ["aa@$lastName"]],
'all_recipients' => ["a@$lastName;alt1@$lastName", "aa@$lastName;alt1@$lastName"],
'subjects' => ['Happy birthday A!', 'Happy birthday AA!'],
],
]);
];
}
$this->assertCronRuns($cronRuns);
}

public function testAlternateRecipients():void {
Expand Down

0 comments on commit 55aa3ea

Please sign in to comment.