feat(catalog): replace selectionOptions with selectorOptions to filter hidden attributes

This commit is contained in:
2026-08-13 08:30:03 -03:00
parent 7c7a295625
commit 97995ae728
6 changed files with 48 additions and 4 deletions

View File

@@ -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);