feat(migration): implement row and seat swapping logic for desfile tenant

This commit is contained in:
2026-08-14 12:17:40 -03:00
parent 21b0517e6c
commit 4be94275f1
2 changed files with 152 additions and 5 deletions

View File

@@ -31,6 +31,11 @@ class CreateDesfilePuraTendenciaTenantTest extends TestCase
);
$migration->up();
$rowAndSeatMigration = require database_path(
'migrations/2026_08_14_030000_swap_desfile_row_and_seat_semantics.php'
);
$rowAndSeatMigration->up();
$footerBackgroundMigration = require database_path(
'migrations/2026_08_12_060000_set_desfile_footer_background_image.php'
);
@@ -186,13 +191,22 @@ class CreateDesfilePuraTendenciaTenantTest extends TestCase
$this->assertSame([
'tipo' => ['VIP + LUNCH', 'NORMAL'],
'sector' => ['A', 'B', 'C', 'D'],
'fila' => array_map('strval', range(1, 17)),
'asiento' => array_map('strval', range(1, 5)),
'fila' => array_map('strval', range(1, 5)),
'asiento' => array_map('strval', range(1, 17)),
], $attributes->map(fn (object $attribute): array => DB::table('attribute_options')
->where('attribute_id', $attribute->id)
->orderBy('sort_order')
->pluck('value')
->all())->all());
$this->assertSame(
['tipo', 'sector', 'fila', 'asiento'],
DB::table('item_attributes')
->join('attribute', 'attribute.id', '=', 'item_attributes.attribute_id')
->where('item_attributes.catalog_item_id', $catalogItem->id)
->orderBy('item_attributes.sort_order')
->pluck('attribute.codigo')
->all(),
);
$variants = DB::table('variantes')->where('catalog_item_id', $catalogItem->id);
@@ -210,6 +224,11 @@ class CreateDesfilePuraTendenciaTenantTest extends TestCase
->where('reserved_stock', 0)
->where('sold_units', 0)
->count());
$this->assertDatabaseHas('variantes', [
'catalog_item_id' => $catalogItem->id,
'descripcion' => 'Sector A - Fila 1 - Asiento 17 - VIP + LUNCH',
'precio' => 250000,
]);
foreach ([
250000 => 34,
@@ -228,15 +247,15 @@ class CreateDesfilePuraTendenciaTenantTest extends TestCase
$this->assertSame(0, $this->variantCountForSelection($catalogItem->id, [
'sector' => ['B', 'D'],
'fila' => ['17'],
'asiento' => ['17'],
]));
$this->assertSame(66, $this->variantCountForSelection($catalogItem->id, [
'tipo' => ['VIP + LUNCH'],
'asiento' => ['1'],
'fila' => ['1'],
]));
$this->assertSame(66, $this->variantCountForSelection($catalogItem->id, [
'tipo' => ['NORMAL'],
'asiento' => ['5'],
'fila' => ['5'],
]));
}