Skip to content

Commit

Permalink
Add actionschedule test for activity tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwire authored and totten committed Aug 11, 2021
1 parent d4da6b9 commit 24bf3d3
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/phpunit/CRM/Core/BAO/ActionScheduleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ public function setUp(): void {
'activity_date_time' => '20120615100000',
'is_current_revision' => 1,
'is_deleted' => 0,
'subject' => 'Phone call',
'details' => 'A phone call about a bear',
];
$this->fixtures['contact'] = [
'is_deceased' => 0,
Expand Down Expand Up @@ -957,6 +959,27 @@ public function mailerExamples(): array {
],
];

// In this example, we test activity tokens
$activityTokens = '{activity.subject};;{activity.details};;{activity.activity_date_time}';
$activity = $this->fixtures['phonecall'];
$activityTokensExpected = "Phone call;;A phone call about a bear;;June 15th, 2012 10:00 AM";
$cases[4] = [
// Schedule definition.
[
'subject' => "subj $someTokensTmpl",
'body_html' => "html {$activityTokens}",
'body_text' => "text {$activityTokens}",
],
// Assertions (regex).
[
'from_name' => '/^FIXME$/',
'from_email' => '/^[email protected]$/',
'subject' => "/^subj $someTokensExpected\$/",
'body_html' => "/^html $activityTokensExpected\$/",
'body_text' => "/^text $activityTokensExpected\$/",
],
];

return $cases;
}

Expand Down

1 comment on commit 24bf3d3

@magnolia61
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @mattwire #20335 still needs a test. I never wrote one (and i'm not really a coder). Would the same approach work for the event & participant tokens?

Please sign in to comment.