From 37604f18319d3821b0942c558718bbf75ba04967 Mon Sep 17 00:00:00 2001 From: DemeritCowboy Date: Fri, 28 Jun 2019 04:59:35 -0400 Subject: [PATCH] test demonstrating dev/core#1082 --- .../CRM/Core/BAO/MessageTemplateTest.php | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 tests/phpunit/CRM/Core/BAO/MessageTemplateTest.php diff --git a/tests/phpunit/CRM/Core/BAO/MessageTemplateTest.php b/tests/phpunit/CRM/Core/BAO/MessageTemplateTest.php new file mode 100644 index 0000000000..45a5bc4a9a --- /dev/null +++ b/tests/phpunit/CRM/Core/BAO/MessageTemplateTest.php @@ -0,0 +1,57 @@ +individualCreate(); + $contact_id = $this->individualCreate(); + + $tplParams = array( + 'isCaseActivity' => 1, + 'client_id' => $client_id, + 'activityTypeName' => 'Follow up', + 'activity' => array( + 'fields' => array( + array( + 'label' => 'Case ID', + 'type' => 'String', + 'value' => '1234', + ), + ), + ), + 'activitySubject' => 'Test 123', + 'idHash' => substr(sha1(CIVICRM_SITE_KEY . '1234'), 0, 7), + ); + + list($sent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplate::sendTemplate( + array( + 'groupName' => 'msg_tpl_workflow_case', + 'valueName' => 'case_activity', + 'contactId' => $contact_id, + 'tplParams' => $tplParams, + 'from' => 'admin@example.com', + 'toName' => 'Demo', + 'toEmail' => 'admin@example.com', + 'attachments' => NULL, + ) + ); + + $this->assertEquals('[case #' . $tplParams['idHash'] . '] Test 123', $subject); + $this->assertContains('Your Case Role', $message); + $this->assertContains('Case ID : 1234', $message); + } + +} -- 2.25.1