diff --git a/app/code/Magento/CatalogGraphQl/Model/Resolver/Product/CustomizableDateTypeOptionValue.php b/app/code/Magento/CatalogGraphQl/Model/Resolver/Product/CustomizableDateTypeOptionValue.php new file mode 100644 index 0000000000000..1b9583cc7239e --- /dev/null +++ b/app/code/Magento/CatalogGraphQl/Model/Resolver/Product/CustomizableDateTypeOptionValue.php @@ -0,0 +1,42 @@ +compareArraysRecursively = $objectManager->create(CompareArraysRecursively::class); + } + + /** + * @magentoApiDataFixture Magento/Catalog/_files/product_with_options.php + * + * @param array $optionDataProvider + * + * @dataProvider getProductCustomizableOptionsProvider + * @throws Exception + */ + public function testQueryCustomizableOptions(array $optionDataProvider): void + { + $productSku = 'simple'; + $query = $this->getQuery($productSku); + $response = $this->graphQlQuery($query); + $responseProduct = reset($response['products']['items']); + self::assertNotEmpty($responseProduct['options']); + + foreach ($optionDataProvider as $key => $data) { + $this->compareArraysRecursively->execute($data, $responseProduct[$key]); + } + } + + /** + * Get query. + * + * @param string $sku + * + * @return string + */ + private function getQuery(string $sku): string + { + return << [ + 'items' => [ + 'options' => [ + [ + 'title' => 'test_option_code_1' + ], + [ + 'title' => 'area option' + ], + [ + 'title' => 'file option' + ], + [ + 'title' => 'radio option' + ], + [ + 'title' => 'multiple option' + ], + [ + 'title' => 'date option', + 'values' => [ + 'type' => 'DATE' + ] + ], + [ + 'title' => 'date_time option', + 'values' => [ + 'type' => 'DATE_TIME' + ] + ], + [ + 'title' => 'time option', + 'values' => [ + 'type' => 'TIME' + ] + ] + ] + ] + ] + ]; + } +}