Skip to content

Commit

Permalink
Remove deprecated facade on v2 (#897)
Browse files Browse the repository at this point in the history
  • Loading branch information
erikn69 authored Jun 29, 2022
1 parent 9d629cf commit d2f4e0a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 29 deletions.
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ You can create a new DOMPDF instance and load a HTML string, file or view name.
Or use the facade:

```php
use Barryvdh\DomPDF\Facade\Pdf;
use PDF;

$pdf = PDF::loadView('pdf.invoice', $data);
return $pdf->download('invoice.pdf');
Expand Down
12 changes: 0 additions & 12 deletions src/Facade.php

This file was deleted.

20 changes: 4 additions & 16 deletions tests/PdfTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,9 @@ public function testFacade(): void
$this->assertEquals('attachment; filename="test.pdf"', $response->headers->get('Content-Disposition'));
}

public function testDeprecatedFacade(): void
{
$pdf = Facade::loadHtml('<h1>Test</h1>');
/** @var Response $response */
$response = $pdf->download('test.pdf');

$this->assertInstanceOf(Response::class, $response);
$this->assertNotEmpty($response->getContent());
$this->assertEquals('application/pdf', $response->headers->get('Content-Type'));
$this->assertEquals('attachment; filename="test.pdf"', $response->headers->get('Content-Disposition'));
}

public function testDownload(): void
{
$pdf = Facade::loadHtml('<h1>Test</h1>');
$pdf = Facade\Pdf::loadHtml('<h1>Test</h1>');
/** @var Response $response */
$response = $pdf->download('test.pdf');

Expand All @@ -57,7 +45,7 @@ public function testDownload(): void

public function testStream(): void
{
$pdf = Facade::loadHtml('<h1>Test</h1>');
$pdf = Facade\Pdf::loadHtml('<h1>Test</h1>');
/** @var Response $response */
$response = $pdf->stream('test.pdf');

Expand All @@ -69,7 +57,7 @@ public function testStream(): void

public function testView(): void
{
$pdf = Facade::loadView('test');
$pdf = Facade\Pdf::loadView('test');
/** @var Response $response */
$response = $pdf->download('test.pdf');

Expand All @@ -81,7 +69,7 @@ public function testView(): void

public function testMagicMethods(): void
{
$pdf = Facade::setBaseHost('host')->setProtocol('protocol')
$pdf = Facade\Pdf::setBaseHost('host')->setProtocol('protocol')
->loadView('test')->setOption(['temp_dir' => 'test_dir'])
->setHttpContext(['ssl' => []]);
/** @var Response $response */
Expand Down

0 comments on commit d2f4e0a

Please sign in to comment.