feat(catalog): replace selectionOptions with selectorOptions to filter hidden attributes
This commit is contained in:
@@ -271,6 +271,31 @@ class CatalogModelsTest extends TestCase
|
||||
);
|
||||
}
|
||||
|
||||
public function test_variant_excludes_hidden_attributes_from_selector_options(): void
|
||||
{
|
||||
$attribute = new Attribute(['codigo' => 'event_date', 'nombre' => 'Fecha']);
|
||||
$attribute->setRelation('options', new EloquentCollection);
|
||||
|
||||
$itemAttribute = new ItemAttribute([
|
||||
'allow_multi_select' => true,
|
||||
'show_in_selector' => false,
|
||||
]);
|
||||
$itemAttribute->id = 1;
|
||||
$itemAttribute->setRelation('attribute', $attribute);
|
||||
|
||||
$eventDate = new EventDate(['date' => '2026-10-09']);
|
||||
$eventDate->id = 20;
|
||||
|
||||
$variant = new Variant;
|
||||
$variant->setRelation('definitions', new EloquentCollection);
|
||||
$variant->setRelation('eventDates', new EloquentCollection([$eventDate]));
|
||||
|
||||
$this->assertSame(
|
||||
[],
|
||||
$variant->selectorOptions(new EloquentCollection([$itemAttribute]))->all(),
|
||||
);
|
||||
}
|
||||
|
||||
public function test_inventory_maps_stock_without_a_polymorphic_owner(): void
|
||||
{
|
||||
$inventory = $this->trackedInventory(realStock: 10, reservedStock: 3);
|
||||
|
||||
Reference in New Issue
Block a user