feat: implement product attribute options with database migration, resource, and validation requests
This commit is contained in:
@@ -37,7 +37,7 @@ class CartControllerTest extends TestCase
|
||||
'tenant_codigo' => 'acme',
|
||||
'codigo' => 'color',
|
||||
'nombre' => 'Color',
|
||||
'type' => 'text',
|
||||
'type' => 'string',
|
||||
]);
|
||||
|
||||
ProductVariantDefinition::query()->create([
|
||||
|
||||
@@ -24,11 +24,13 @@ class ProductAttributeControllerTest extends TestCase
|
||||
],
|
||||
'options' => [
|
||||
[
|
||||
'value' => 'red',
|
||||
'label' => 'Red',
|
||||
'sort_order' => 1,
|
||||
'metadata' => ['hex' => '#ff0000'],
|
||||
],
|
||||
[
|
||||
'value' => 'blue',
|
||||
'label' => 'Blue',
|
||||
'sort_order' => 2,
|
||||
'metadata' => ['hex' => '#0000ff'],
|
||||
@@ -41,6 +43,7 @@ class ProductAttributeControllerTest extends TestCase
|
||||
->assertJsonPath('data.tenant_codigo', 'acme')
|
||||
->assertJsonPath('data.codigo', 'color')
|
||||
->assertJsonPath('data.type', 'select')
|
||||
->assertJsonPath('data.options.0.value', 'red')
|
||||
->assertJsonPath('data.options.0.label', 'Red')
|
||||
->assertJsonPath('data.options.1.metadata.hex', '#0000ff');
|
||||
|
||||
@@ -51,6 +54,7 @@ class ProductAttributeControllerTest extends TestCase
|
||||
]);
|
||||
|
||||
$this->assertDatabaseHas('attribute_options', [
|
||||
'value' => 'red',
|
||||
'label' => 'Red',
|
||||
'sort_order' => 1,
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user