feat: implement product and attribute management services with corresponding controllers and feature tests
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user