Skip to content

Commit

Permalink
Added option_id in response for product with customizable options.
Browse files Browse the repository at this point in the history
  • Loading branch information
VoronoyAlexandr committed Nov 12, 2018
1 parent 072ef37 commit 548ca3c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/code/Magento/CatalogGraphQl/etc/schema.graphqls
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ interface CustomizableOptionInterface @typeResolver(class: "Magento\\CatalogGrap
title: String @doc(description: "The display name for this option")
required: Boolean @doc(description: "Indicates whether the option is required")
sort_order: Int @doc(description: "The order in which the option is displayed")
option_id: Int @doc(description: "Option ID")
}

interface CustomizableProductInterface @typeResolver(class: "Magento\\CatalogGraphQl\\Model\\ProductInterfaceTypeResolverComposite") @doc(description: "CustomizableProductInterface contains information about customizable product options.") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public function testQueryAllFieldsSimpleProduct()
title
required
sort_order
option_id
... on CustomizableFieldOption {
product_sku
field_option: value {
Expand Down Expand Up @@ -337,6 +338,7 @@ public function testQueryMediaGalleryEntryFieldsSimpleProduct()
title
required
sort_order
option_id
... on CustomizableFieldOption {
product_sku
field_option: value {
Expand Down Expand Up @@ -753,7 +755,8 @@ private function assertOptions($product, $actualResponse)
$assertionMap = [
['response_field' => 'sort_order', 'expected_value' => $option->getSortOrder()],
['response_field' => 'title', 'expected_value' => $option->getTitle()],
['response_field' => 'required', 'expected_value' => $option->getIsRequire()]
['response_field' => 'required', 'expected_value' => $option->getIsRequire()],
['response_field' => 'option_id', 'expected_value' => $option->getOptionId()]
];

if (!empty($option->getValues())) {
Expand All @@ -777,7 +780,7 @@ private function assertOptions($product, $actualResponse)
['response_field' => 'product_sku', 'expected_value' => $option->getProductSku()],
]
);
$valueKeyName = "";

if ($option->getType() === 'file') {
$valueKeyName = 'file_option';
$valueAssertionMap = [
Expand Down

0 comments on commit 548ca3c

Please sign in to comment.