Skip to content

Commit

Permalink
Revert "Fix setOptions method (#974)" (#1039)
Browse files Browse the repository at this point in the history
This reverts commit 0918341.
  • Loading branch information
barryvdh authored Mar 15, 2024
1 parent c8b8a84 commit cb37868
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 21 deletions.
6 changes: 3 additions & 3 deletions src/PDF.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, mixed> $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;
}

Expand Down
18 changes: 0 additions & 18 deletions tests/PdfTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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('<h1>Test</h1>');
$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')
Expand Down

0 comments on commit cb37868

Please sign in to comment.