From 58fb198108384750a8c3a36ff456d5deb7ef30f9 Mon Sep 17 00:00:00 2001 From: "A. Alyusuf" Date: Tue, 19 Nov 2024 08:28:33 +0000 Subject: [PATCH] Add png save test --- tests/PdfTest.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/PdfTest.php b/tests/PdfTest.php index 003888a..b0193c2 100644 --- a/tests/PdfTest.php +++ b/tests/PdfTest.php @@ -157,3 +157,22 @@ expect($this->targetPath)->toContainText('hello'); }); + +it('can save as png in local and disk', function () { + Storage::fake('local'); + + $firstPath = getTempPath('first.png'); + Pdf::view('test') + ->save($firstPath); + + expect(mime_content_type($firstPath)) + ->toBe('image/png'); + + Pdf::view('test') + ->disk('local') + ->save('second.png'); + + expect(Storage::disk('local') + ->mimeType('second.png')) + ->toBe('image/png'); +});