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')