Skip to content

Commit

Permalink
ENGCOM-3453: Added option_id in response for product with customizabl…
Browse files Browse the repository at this point in the history
…e options. #247

 - Merge Pull Request magento/graphql-ce#247 from VoronoyAlexandr/graphql-ce:235_added_option_id_in_response_for_product_with_customizable_options
 - Merged commits:
   1. 548ca3c
  • Loading branch information
magento-engcom-team committed Nov 13, 2018
2 parents 5f976fa + 548ca3c commit b347e74
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 @@ -90,6 +90,7 @@ public function testQueryAllFieldsSimpleProduct()
title
required
sort_order
option_id
... on CustomizableFieldOption {
product_sku
field_option: value {
Expand Down Expand Up @@ -334,6 +335,7 @@ public function testQueryMediaGalleryEntryFieldsSimpleProduct()
title
required
sort_order
option_id
... on CustomizableFieldOption {
product_sku
field_option: value {
Expand Down Expand Up @@ -749,7 +751,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 @@ -773,7 +776,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 b347e74

Please sign in to comment.