From: eileen Date: Tue, 2 Feb 2021 00:59:37 +0000 (+1300) Subject: Fix for ReportTest when launching a pdf X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=cb66edd5b53fdcc75f002a24e6750866c4fccc6a;p=civicrm-core.git Fix for ReportTest when launching a pdf --- 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,