From cb37868365f9b937039d316727a1fced1e87b31c Mon Sep 17 00:00:00 2001 From: "Barry vd. Heuvel" Date: Fri, 15 Mar 2024 13:48:39 +0100 Subject: [PATCH] Revert "Fix setOptions method (#974)" (#1039) This reverts commit 0918341c9b22329ebbe693bcc304852c000d1de3. --- src/PDF.php | 6 +++--- tests/PdfTest.php | 18 ------------------ 2 files changed, 3 insertions(+), 21 deletions(-) diff --git a/src/PDF.php b/src/PDF.php index ae9f53d..2b68b94 100644 --- a/src/PDF.php +++ b/src/PDF.php @@ -156,13 +156,13 @@ public function setOption($attribute, $value = null): self /** * Replace all the Options from DomPDF * + * @deprecated Use setOption to override individual options. * @param array $options */ public function setOptions(array $options): self { - $dompdfOptions = new Options(app()->make('dompdf.options')); - $dompdfOptions->set($options); - $this->dompdf->setOptions($dompdfOptions); + $options = new Options($options); + $this->dompdf->setOptions($options); return $this; } diff --git a/tests/PdfTest.php b/tests/PdfTest.php index 75498b4..27bbe13 100644 --- a/tests/PdfTest.php +++ b/tests/PdfTest.php @@ -96,24 +96,6 @@ public function testSaveOnDisk(): void $this->assertEquals($content, $pdf->output()); } - public function testConfigOptions(): void - { - \Config::set('dompdf.options.default_font', 'default_font'); - \Config::set('dompdf.options.log_output_file', 'default_log'); - - $pdf = Facade\Pdf::loadHtml('

Test

'); - $this->assertEquals('default_font', $pdf->getDomPDF()->getOptions()->getDefaultFont()); - $this->assertEquals('default_log', $pdf->getDomPDF()->getOptions()->getLogOutputFile()); - - $pdf->setOption('default_font', 'custom_font'); - $this->assertEquals('custom_font', $pdf->getDomPDF()->getOptions()->getDefaultFont()); - $this->assertEquals('default_log', $pdf->getDomPDF()->getOptions()->getLogOutputFile()); - - $pdf->setOptions([]); // reset options to config/dompdf.php - $this->assertEquals('default_font', $pdf->getDomPDF()->getOptions()->getDefaultFont()); - $this->assertEquals('default_log', $pdf->getDomPDF()->getOptions()->getLogOutputFile()); - } - public function testMagicMethods(): void { $pdf = Facade\Pdf::setBaseHost('host')->setProtocol('protocol')