79402470

Date: 2025-01-31 10:43:50
Score: 1.5
Natty:
Report link

Check two approcaches:

// Mock the storage behavior
Storage::shouldReceive('disk')->with(StorageDiskName::DO_S3->value)->andReturnSelf();
Storage::shouldReceive('temporaryUrl')->andReturn($expectedUrl);


// Mock the fake filesystem
$fakeFilesystem = Storage::fake(StorageDiskName::DO_S3->value);
$proxyMockedFakeFilesystem = Mockery::mock($fakeFilesystem);
$proxyMockedFakeFilesystem->shouldReceive('temporaryUrl')->andReturn($expectedUrl);
Storage::set(StorageDiskName::DO_S3->value, $proxyMockedFakeFilesystem);

See more in the article: https://dev.to/tegos/testing-temporary-urls-in-laravel-storage-20p7

Reasons:
  • Probably link only (1):
  • Contains signature (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Tegos