07-05-2026

This commit is contained in:
Kevin Adametz 2026-05-07 13:03:01 +00:00
parent 3f3a81a21c
commit 18ca2ce858
11 changed files with 40 additions and 12 deletions

View file

@ -7,6 +7,7 @@ use App\Models\User;
use App\Services\DisplayMediaService;
use Illuminate\Http\UploadedFile;
use Illuminate\Support\Facades\Storage;
use Livewire\Volt\Volt;
use Spatie\Permission\Models\Role;
beforeEach(function () {
@ -128,7 +129,7 @@ it('stores an uploaded file', function () {
->and($media->collection)->toBe('immobilien')
->and($media->path)->not->toBeNull();
Storage::disk('public')->assertExists($media->path);
expect(Storage::disk('public')->exists($media->path))->toBeTrue();
});
it('stores a video upload', function () {
@ -141,6 +142,25 @@ it('stores a video upload', function () {
->and($media->mime_type)->toBe('video/mp4');
});
it('accepts display media videos up to 200 mb', function () {
$file = UploadedFile::fake()->create('showroom.mp4', 204800, 'video/mp4');
Volt::test('admin.cms.display-media-library')
->set('uploads', [$file])
->call('handleUploads')
->assertHasNoErrors();
$media = DisplayMedia::query()->first();
expect($media)->not->toBeNull()
->and($media->filename)->toBe('showroom.mp4')
->and($media->type)->toBe('video');
});
it('configures livewire temporary uploads up to 200 mb', function () {
expect(config('livewire.temporary_file_upload.rules'))->toContain('max:204800');
});
it('creates media from external URL', function () {
$service = app(DisplayMediaService::class);
@ -165,11 +185,11 @@ it('deletes uploaded media and its file', function () {
$media = $service->storeUpload($file);
$path = $media->path;
Storage::disk('public')->assertExists($path);
expect(Storage::disk('public')->exists($path))->toBeTrue();
$service->delete($media);
Storage::disk('public')->assertMissing($path);
expect(Storage::disk('public')->exists($path))->toBeFalse();
expect(DisplayMedia::find($media->id))->toBeNull();
});