feat: implement product and attribute management services with corresponding controllers and feature tests

This commit is contained in:
2026-06-29 11:37:22 -03:00
parent b5b57a753c
commit 9b7d728117
7 changed files with 365 additions and 137 deletions

View File

@@ -78,6 +78,23 @@ class AttributeControllerTest extends TestCase
->assertJsonValidationErrors(['options']);
}
public function test_it_throws_exception_when_creating_non_select_attribute_with_options_directly_on_model(): void
{
$tenant = $this->createTenant('acme2', 'Acme 2', 'acme2.com');
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Options are only allowed for select and multiselect attributes.');
\App\Domains\Catalog\Models\Product::createAttribute($tenant, [
'codigo' => 'material2',
'nombre' => 'Material 2',
'type' => 'string',
'options' => [
['label' => 'Cotton', 'value' => 'cotton'],
],
]);
}
protected function createTenant(string $codigo, string $nombre, string $dominio): Tenant
{
$hdrKey = (string) \Illuminate\Support\Str::uuid();