From b74fb3cebee5737d18a0250525dcab144d933277 Mon Sep 17 00:00:00 2001 From: Martin Zurowietz Date: Thu, 14 Apr 2022 16:35:00 +0200 Subject: [PATCH] Fix tests Recent versions of Laravel support fake temporary URLs for the fake storage disk. --- .../Api/StorageRequestFileControllerTest.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/Http/Controllers/Api/StorageRequestFileControllerTest.php b/tests/Http/Controllers/Api/StorageRequestFileControllerTest.php index 058732c..dcbd4cf 100644 --- a/tests/Http/Controllers/Api/StorageRequestFileControllerTest.php +++ b/tests/Http/Controllers/Api/StorageRequestFileControllerTest.php @@ -9,6 +9,7 @@ use Illuminate\Http\UploadedFile; use Illuminate\Support\Facades\Bus; use Mockery; +use RuntimeException; use Storage; class StorageRequestFileControllerTest extends ApiTestCase @@ -256,6 +257,10 @@ public function testShow() { config(['user_storage.pending_disk' => 'test']); $disk = Storage::fake('test'); + $disk->buildTemporaryUrlsUsing(function () { + // Act as if the storage disk driver does not support temporary URLs. + throw new RuntimeException; + }); $disk->put("request-{$id}/a.jpg", 'abc'); $disk->put("request-{$id}/c.jpg", 'abc'); @@ -282,6 +287,10 @@ public function testShowApproved() { config(['user_storage.storage_disk' => 'test']); $disk = Storage::fake('test'); + $disk->buildTemporaryUrlsUsing(function () { + // Act as if the storage disk driver does not support temporary URLs. + throw new RuntimeException; + }); $disk->put("user-{$request->user_id}/a.jpg", 'abc'); $this->beGlobalAdmin(); @@ -311,6 +320,10 @@ public function testShowUrlEncode() { config(['user_storage.pending_disk' => 'test']); $disk = Storage::fake('test'); + $disk->buildTemporaryUrlsUsing(function () { + // Act as if the storage disk driver does not support temporary URLs. + throw new RuntimeException; + }); $disk->put("request-{$id}/my dir/a.jpg", 'abc'); $this->beGlobalAdmin();