mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-app.git
synced 2026-07-02 09:00:23 +00:00
🎨 Add AVIF logo support to Meetups and tests
This commit is contained in:
@@ -163,7 +163,7 @@ class Meetup extends Model implements HasMedia
|
|||||||
{
|
{
|
||||||
$this
|
$this
|
||||||
->addMediaCollection('logo')
|
->addMediaCollection('logo')
|
||||||
->acceptsMimeTypes(['image/jpeg', 'image/png', 'image/gif', 'image/webp'])
|
->acceptsMimeTypes(['image/jpeg', 'image/png', 'image/gif', 'image/webp', 'image/avif'])
|
||||||
->singleFile()
|
->singleFile()
|
||||||
->useFallbackUrl(get_domain_attributes()['image']);
|
->useFallbackUrl(get_domain_attributes()['image']);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
use App\Models\City;
|
use App\Models\City;
|
||||||
use App\Models\Country;
|
use App\Models\Country;
|
||||||
use App\Models\Meetup;
|
use App\Models\Meetup;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
use Livewire\Livewire;
|
use Livewire\Livewire;
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
@@ -26,6 +27,19 @@ it('creates a Meetup when authenticated user submits a valid form', function ()
|
|||||||
->and($meetup->city_id)->toBe($this->city->id);
|
->and($meetup->city_id)->toBe($this->city->id);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('accepts an avif file into the logo media collection', function () {
|
||||||
|
Storage::fake('public');
|
||||||
|
|
||||||
|
$path = sys_get_temp_dir().'/'.uniqid('avif_', true).'.avif';
|
||||||
|
imageavif(imagecreatetruecolor(1, 1), $path);
|
||||||
|
|
||||||
|
$meetup = Meetup::factory()->create(['city_id' => $this->city->id]);
|
||||||
|
|
||||||
|
$meetup->addMedia($path)->toMediaCollection('logo');
|
||||||
|
|
||||||
|
expect($meetup->getFirstMedia('logo'))->not->toBeNull();
|
||||||
|
});
|
||||||
|
|
||||||
it('rejects creation without a name', function () {
|
it('rejects creation without a name', function () {
|
||||||
actingAsUser();
|
actingAsUser();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user