From ad1e89e3f3ae97720be74b4de3b4c6fd19ff6fe2 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Mon, 6 Sep 2021 14:14:33 +1200 Subject: [PATCH] dev/core#2814 Fix test to use renderTemplate --- .../CRM/Contact/Form/Task/PrintDocumentTest.php | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/tests/phpunit/CRM/Contact/Form/Task/PrintDocumentTest.php b/tests/phpunit/CRM/Contact/Form/Task/PrintDocumentTest.php index 6bc73a8323..680ac896e9 100644 --- a/tests/phpunit/CRM/Contact/Form/Task/PrintDocumentTest.php +++ b/tests/phpunit/CRM/Contact/Form/Task/PrintDocumentTest.php @@ -31,7 +31,7 @@ class CRM_Contact_Form_Task_PrintDocumentTest extends CiviUnitTestCase { /** * Test the documents got token replaced rightfully. */ - public function testPrintDocument() { + public function testPrintDocument(): void { foreach (['docx', 'odt'] as $docType) { $formValues = [ 'document_file' => [ @@ -56,16 +56,7 @@ class CRM_Contact_Form_Task_PrintDocumentTest extends CiviUnitTestCase { 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; -- 2.25.1