From cb66edd5b53fdcc75f002a24e6750866c4fccc6a Mon Sep 17 00:00:00 2001 From: eileen Date: Tue, 2 Feb 2021 13:59:37 +1300 Subject: [PATCH] Fix for ReportTest when launching a pdf --- CRM/Utils/PDF/Utils.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CRM/Utils/PDF/Utils.php b/CRM/Utils/PDF/Utils.php index 7ea2bcf12f..526202cb7c 100644 --- a/CRM/Utils/PDF/Utils.php +++ b/CRM/Utils/PDF/Utils.php @@ -193,7 +193,9 @@ class CRM_Utils_PDF_Utils { } // CRM-19183 remove .pdf extension from filename $fileName = basename($fileName, ".pdf"); - if (CIVICRM_UF === 'UnitTests') { + if (CIVICRM_UF === 'UnitTests' && headers_sent()) { + // Streaming content will 'die' in unit tests unless ob_start() + // has been called. throw new CRM_Core_Exception_PrematureExitException('_html2pdf_dompdf called', [ 'html' => $html, 'fileName' => $fileName, -- 2.25.1