feat(invitation): update seat allocation structure and enhance provisioning logic
This commit is contained in:
@@ -288,19 +288,19 @@ class DesfilePuraTendenciaSeederTest extends TestCase
|
||||
|
||||
$items = DB::table('compra_items')->where('compra_id', $purchase->id);
|
||||
|
||||
$this->assertSame(46, (clone $items)->count());
|
||||
$this->assertSame(46, (clone $items)
|
||||
$this->assertSame(48, (clone $items)->count());
|
||||
$this->assertSame(48, (clone $items)
|
||||
->where('precio_unitario', 0)
|
||||
->where('discount_total', 0)
|
||||
->where('tax_total', 0)
|
||||
->where('total', 0)
|
||||
->count());
|
||||
$this->assertSame(46, DB::table('tickets')
|
||||
$this->assertSame(48, DB::table('tickets')
|
||||
->where('source_purchase_id', $purchase->id)
|
||||
->where('user_id', $user->id)
|
||||
->where('source_catalog_item_id', $catalogItemId)
|
||||
->count());
|
||||
$this->assertSame(46, DB::table('stock_reservations')
|
||||
$this->assertSame(48, DB::table('stock_reservations')
|
||||
->where('purchase_id', $purchase->id)
|
||||
->where('status', 'committed')
|
||||
->count());
|
||||
@@ -309,6 +309,7 @@ class DesfilePuraTendenciaSeederTest extends TestCase
|
||||
['sector' => 'A', 'fila' => '1', 'tipo' => 'NORMAL', 'count' => 16],
|
||||
['sector' => 'A', 'fila' => '3', 'tipo' => 'NORMAL', 'count' => 14],
|
||||
['sector' => 'C', 'fila' => '1', 'tipo' => 'VIP + LUNCH', 'count' => 16],
|
||||
['sector' => 'C', 'fila' => '3', 'tipo' => 'NORMAL', 'count' => 2, 'seats' => ['6', '7']],
|
||||
] as $allocation) {
|
||||
$allocatedVariants = DB::table('variantes')
|
||||
->where('catalog_item_id', $catalogItemId)
|
||||
@@ -326,6 +327,20 @@ class DesfilePuraTendenciaSeederTest extends TestCase
|
||||
}
|
||||
|
||||
$this->assertSame($allocation['count'], $allocatedVariants->count());
|
||||
|
||||
if (isset($allocation['seats'])) {
|
||||
$seatValues = DB::table('variant_values')
|
||||
->join('item_attributes', 'item_attributes.id', '=', 'variant_values.item_attribute_id')
|
||||
->join('attribute', 'attribute.id', '=', 'item_attributes.attribute_id')
|
||||
->whereIn('variant_values.variant_id', (clone $allocatedVariants)->pluck('id'))
|
||||
->where('attribute.codigo', 'asiento')
|
||||
->pluck('variant_values.value')
|
||||
->sort()
|
||||
->values()
|
||||
->all();
|
||||
|
||||
$this->assertSame($allocation['seats'], $seatValues);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user