Skip to content

Commit

Permalink
rename to pdf builder
Browse files Browse the repository at this point in the history
  • Loading branch information
freekmurze committed Dec 28, 2023
1 parent 20357a5 commit cb53ff5
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 12 deletions.
8 changes: 4 additions & 4 deletions src/Facades/Pdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
use Spatie\LaravelPdf\FakePdf;

/**
* @mixin \Spatie\LaravelPdf\Pdf
* @mixin \Spatie\LaravelPdf\PdfBuilder
*/
class Pdf extends Facade
{
protected static function getFacadeAccessor()
{
return \Spatie\LaravelPdf\Pdf::class;
return \Spatie\LaravelPdf\PdfBuilder::class;
}

public static function fake()
Expand All @@ -22,9 +22,9 @@ public static function fake()
static::swap($fake);
}

public static function default(): \Spatie\LaravelPdf\Pdf
public static function default(): \Spatie\LaravelPdf\PdfBuilder
{
$pdf = new \Spatie\LaravelPdf\Pdf();
$pdf = new \Spatie\LaravelPdf\PdfBuilder();

static::swap($pdf);

Expand Down
6 changes: 3 additions & 3 deletions src/FakePdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
use Illuminate\Http\Response;
use PHPUnit\Framework\Assert;

class FakePdf extends Pdf
class FakePdf extends PdfBuilder
{
/** @var array<int, \Spatie\LaravelPdf\Pdf> */
/** @var array<int, \Spatie\LaravelPdf\PdfBuilder> */
protected array $respondedWithPdf = [];

/** @var array<int, \Spatie\LaravelPdf\Pdf> */
/** @var array<int, \Spatie\LaravelPdf\PdfBuilder> */
protected array $savedPdfs = [];

public function assertViewIs(string $viewName): void
Expand Down
2 changes: 1 addition & 1 deletion src/Pdf.php → src/PdfBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use Spatie\LaravelPdf\Enums\Orientation;
use Spatie\LaravelPdf\Enums\PaperFormat;

class Pdf implements Responsable
class PdfBuilder implements Responsable
{
public string $viewName = '';

Expand Down
7 changes: 4 additions & 3 deletions src/Support/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

namespace Spatie\LaravelPdf\Support;

use Spatie\LaravelPdf\Pdf;
use Spatie\LaravelPdf\Facades\Pdf;
use Spatie\LaravelPdf\PdfBuilder;

function pdf(string $viewPath, array $data = []): Pdf
function pdf(string $viewPath, array $data = []): PdfBuilder
{
return \Spatie\LaravelPdf\Facades\Pdf::view($viewPath, $data);
return Pdf::view($viewPath, $data);
}
3 changes: 2 additions & 1 deletion tests/FakePdfTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
use Illuminate\Support\Facades\Route;
use Spatie\LaravelPdf\Facades\Pdf;

use Spatie\LaravelPdf\PdfBuilder;
use function Spatie\LaravelPdf\Support\pdf;

beforeEach(function () {
Expand Down Expand Up @@ -30,7 +31,7 @@
->get('pdf')
->assertSuccessful();

Pdf::assertRespondedWithPdf(function (Spatie\LaravelPdf\Pdf $pdf) {
Pdf::assertRespondedWithPdf(function (PdfBuilder $pdf) {
return $pdf->viewName === 'test'
&& $pdf->isInline();
});
Expand Down

0 comments on commit cb53ff5

Please sign in to comment.