feat(food): implement FoodController, FoodService, and related resources for managing food items and variants

refactor(catalog): add description and price fields to variants and update related resources

feat(migration): add commercial overrides to variants with description and price fields

test(food): add tests for FoodController and ensure correct seeding of food items and variants
This commit is contained in:
2026-08-07 14:17:51 -03:00
parent 6a6d3690cc
commit e1ad27ecf0
19 changed files with 725 additions and 6 deletions

View File

@@ -74,6 +74,21 @@ class FiestaFutbolInfantilProductSeederTest extends TestCase
$abono->variants->map(fn ($variant): int => $variant->eventDates->count())->all(),
);
$food = CatalogItem::query()
->where('tenant_code', $tenant->codigo)
->where('slug', 'comida')
->with('variants')
->sole();
$this->assertSame('4000.00', $food->precio);
$this->assertCount(24, $food->variants->pluck('descripcion')->unique());
$this->assertEqualsCanonicalizing(
['4000.00', '8000.00', '10000.00'],
$food->variants->pluck('precio')->unique()->values()->all(),
);
$this->assertTrue($food->variants->every(
fn ($variant): bool => $variant->descripcion !== null && $variant->precio !== null
));
$featuredGroup = FeaturedGroup::query()->where('tenant_code', $tenant->codigo)->sole();
$this->assertSame(FeaturedGroupSource::All, $featuredGroup->source_type);
$this->assertNull($featuredGroup->category_id);