feat(tenant): add hero carousel images and update related services and tests

This commit is contained in:
2026-09-17 16:47:49 -03:00
parent 5aad43f2e3
commit 164187f47b
13 changed files with 130 additions and 16 deletions

View File

@@ -2,6 +2,7 @@
namespace Tests\Feature\Seeders;
use App\Domains\Attachable\Models\Attachment;
use App\Domains\Tenant\Models\Tenant;
use App\Domains\Tenant\Models\AdminWebsiteType;
use Database\Seeders\SocialMediaSeeder;
@@ -47,6 +48,29 @@ class TenantSeederTest extends TestCase
foreach ([$tenant->headerLogo, $tenant->footerLogo, $tenant->favicon, $tenant->headerBackgroundImage] as $attachment) {
Storage::disk('s3')->assertExists($attachment->path);
}
$carousel = $tenant->websiteExtras()
->whereHas('websiteTypeExtra', fn ($query) => $query->where('codigo', 'heroCarousel'))
->sole();
$imageIds = $carousel->config;
$this->assertCount(8, $imageIds);
$this->assertSame([
'onticket_hero_carousel_1.png',
'onticket_hero_carousel_2.png',
'onticket_hero_carousel_3.avif',
'onticket_hero_carousel_4.jfif',
'onticket_hero_carousel_5.jfif',
'onticket_hero_carousel_6.jfif',
'onticket_hero_carousel_7.avif',
'onticket_hero_carousel_8.avif',
], array_map(fn (int $id): string => Attachment::query()->findOrFail($id)->filename, $imageIds));
foreach ($imageIds as $id) {
Storage::disk('s3')->assertExists(Attachment::query()->findOrFail($id)->path);
}
$this->seed(TenantSeeder::class);
$this->assertSame($imageIds, $carousel->fresh()->config);
}
public function test_it_assigns_social_media_to_both_tenants_in_order(): void

View File

@@ -89,7 +89,8 @@ class WebsiteTypeSeederTest extends TestCase
$this->assertSame('standard', $onTicketStorefront->header_type);
$multiEventStorefront = StorefrontWebsiteType::query()->where('codigo', 'onticket_multi_event')->with('extras')->sole();
$this->assertSame('immersive', $multiEventStorefront->header_type);
$this->assertCount(0, $multiEventStorefront->extras);
$this->assertSame(['heroCarousel'], $multiEventStorefront->extras->pluck('codigo')->all());
$this->assertSame($shopItStorefront->extras->sole()->config_schema, $multiEventStorefront->extras->sole()->config_schema);
$this->assertEqualsCanonicalizing(
['heroConfig', 'eventConfig', 'additionalInfoConfig'],
$onTicketStorefront->extras->pluck('codigo')->all(),