mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-10-12 15:53:19 +01:00
Set content-disposition 'attachment' for both local and S3 downloads. Added a bunch of tests. Fixes #1148.
This commit is contained in:
committed by
Gregor Vostrak
parent
ed3ba0135b
commit
453d5ed066
@@ -4,6 +4,9 @@ declare(strict_types=1);
|
||||
|
||||
namespace Tests\Unit\Endpoint\Api\V1;
|
||||
|
||||
use Closure;
|
||||
use DateTimeInterface;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Testing\TestResponse;
|
||||
use Tests\TestCaseWithDatabase;
|
||||
|
||||
@@ -16,4 +19,26 @@ class ApiEndpointTestAbstract extends TestCaseWithDatabase
|
||||
}
|
||||
$response->assertStatus($statusCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Replaces the temporary URL builder of the private disk to capture the options
|
||||
* passed to temporaryUrl. Returns a closure that yields the captured options.
|
||||
*
|
||||
* @return Closure(): (array<string, mixed>|null)
|
||||
*/
|
||||
protected function captureTemporaryUrlOptions(): Closure
|
||||
{
|
||||
$captured = null;
|
||||
Storage::disk(config('filesystems.private'))->buildTemporaryUrlsUsing(
|
||||
function (string $path, DateTimeInterface $expiration, array $options) use (&$captured): string {
|
||||
$captured = $options;
|
||||
|
||||
return 'https://storage.fake/'.$path;
|
||||
}
|
||||
);
|
||||
|
||||
return function () use (&$captured): ?array {
|
||||
return $captured;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user