Skip to content

Commit

Permalink
Merge pull request #21378 from eileenmcnaughton/act_test
Browse files Browse the repository at this point in the history
dev/core#2814 Fix test to use renderTemplate
  • Loading branch information
eileenmcnaughton authored Sep 6, 2021
2 parents 9d08eac + ad1e89e commit eab41dc
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions tests/phpunit/CRM/Contact/Form/Task/PrintDocumentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ protected function setUp(): void {
/**
* Test the documents got token replaced rightfully.
*/
public function testPrintDocument() {
public function testPrintDocument(): void {
foreach (['docx', 'odt'] as $docType) {
$formValues = [
'document_file' => [
Expand All @@ -56,16 +56,7 @@ public function _testDocumentContent($formValues, $type) {
list($html_message, $zip) = CRM_Utils_PDF_Document::unzipDoc($formValues['document_file_path'], $formValues['document_type']);

foreach ($this->_contactIds as $item => $contactId) {
$params = ['contact_id' => $contactId];
list($contact) = CRM_Utils_Token::getTokenDetails($params,
$returnProperties,
FALSE,
FALSE,
NULL,
$messageToken,
'CRM_Contact_Form_Task_PDFLetterCommon'
);
$html[] = CRM_Utils_Token::replaceContactTokens($html_message, $contact[$contactId], TRUE, $messageToken);
$html[] = CRM_Core_BAO_MessageTemplate::renderTemplate(['messageTemplate' => ['msg_html' => $html_message], 'contactId' => $contactId, 'disableSmarty' => TRUE])['html'];
}

$fileName = pathinfo($formValues['document_file_path'], PATHINFO_FILENAME) . '.' . $type;
Expand Down

0 comments on commit eab41dc

Please sign in to comment.