From 0ad43113fd22031399b99d225858b69d7f1df515 Mon Sep 17 00:00:00 2001 From: Andrii Beziazychnyi Date: Wed, 28 Oct 2020 17:27:40 +0200 Subject: [PATCH 1/4] CE#30625: The fields that described below has been deprecated - special_from_date - attribute_set_id - new_from_date - new_to_date - created_at - updated_at --- .../CatalogGraphQl/etc/schema.graphqls | 12 ++-- .../CategoriesQuery/CategoryTreeTest.php | 40 ------------- .../Magento/GraphQl/Catalog/CategoryTest.php | 43 +------------- .../GraphQl/Catalog/ProductViewTest.php | 59 +------------------ .../Framework/QueryComplexityLimiterTest.php | 25 -------- 5 files changed, 9 insertions(+), 170 deletions(-) diff --git a/app/code/Magento/CatalogGraphQl/etc/schema.graphqls b/app/code/Magento/CatalogGraphQl/etc/schema.graphqls index 35067a6cb99af..7c52f2ff959b2 100644 --- a/app/code/Magento/CatalogGraphQl/etc/schema.graphqls +++ b/app/code/Magento/CatalogGraphQl/etc/schema.graphqls @@ -89,21 +89,21 @@ interface ProductInterface @typeResolver(class: "Magento\\CatalogGraphQl\\Model\ description: ComplexTextValue @doc(description: "Detailed information about the product. The value can include simple HTML tags.") @resolver(class: "\\Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\ProductComplexTextAttribute") short_description: ComplexTextValue @doc(description: "A short description of the product. Its use depends on the theme.") @resolver(class: "\\Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\ProductComplexTextAttribute") special_price: Float @doc(description: "The discounted price of the product.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\SpecialPrice") - special_from_date: String @doc(description: "The beginning date that a product has a special price.") + special_from_date: String @deprecated(reason: "The field should not be used on the storefront.") @doc(description: "The beginning date that a product has a special price.") special_to_date: String @doc(description: "The end date that a product has a special price.") - attribute_set_id: Int @doc(description: "The attribute set assigned to the product.") + attribute_set_id: Int @deprecated(reason: "The field should not be used on the storefront.") @doc(description: "The attribute set assigned to the product.") meta_title: String @doc(description: "A string that is displayed in the title bar and tab of the browser and in search results lists.") meta_keyword: String @doc(description: "A comma-separated list of keywords that are visible only to search engines.") meta_description: String @doc(description: "A brief overview of the product for search results listings, maximum 255 characters.") image: ProductImage @doc(description: "The relative path to the main image on the product page.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\ProductImage") small_image: ProductImage @doc(description: "The relative path to the small image, which is used on catalog pages.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\ProductImage") thumbnail: ProductImage @doc(description: "The relative path to the product's thumbnail image.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\ProductImage") - new_from_date: String @doc(description: "The beginning date for new product listings, and determines if the product is featured as a new product.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\NewFromTo") - new_to_date: String @doc(description: "The end date for new product listings.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\NewFromTo") + new_from_date: String @deprecated(reason: "The field should not be used on the storefront.") @doc(description: "The beginning date for new product listings, and determines if the product is featured as a new product.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\NewFromTo") + new_to_date: String @deprecated(reason: "The field should not be used on the storefront.") @doc(description: "The end date for new product listings.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\NewFromTo") tier_price: Float @deprecated(reason: "Use price_tiers for product tier price information.") @doc(description: "The price when tier pricing is in effect and the items purchased threshold has been reached.") options_container: String @doc(description: "If the product has multiple options, determines where they appear on the product page.") - created_at: String @doc(description: "Timestamp indicating when the product was created.") - updated_at: String @doc(description: "Timestamp indicating when the product was updated.") + created_at: String @deprecated(reason: "The field should not be used on the storefront.") @doc(description: "Timestamp indicating when the product was created.") + updated_at: String @deprecated(reason: "The field should not be used on the storefront.") @doc(description: "Timestamp indicating when the product was updated.") country_of_manufacture: String @doc(description: "The product's country of origin.") type_id: String @doc(description: "One of simple, virtual, bundle, downloadable, grouped, or configurable.") @deprecated(reason: "Use __typename instead.") websites: [Website] @doc(description: "An array of websites in which the product is available.") @deprecated(reason: "The field should not be used on the storefront.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\Websites") diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/CategoriesQuery/CategoryTreeTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/CategoriesQuery/CategoryTreeTest.php index 641253cc34c2c..40890a5ac0186 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/CategoriesQuery/CategoryTreeTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/CategoriesQuery/CategoryTreeTest.php @@ -308,9 +308,7 @@ public function testCategoryProducts() page_size } items { - attribute_set_id country_of_manufacture - created_at description { html } @@ -349,8 +347,6 @@ public function testCategoryProducts() } } name - new_from_date - new_to_date options_container price { minimalPrice { @@ -409,7 +405,6 @@ public function testCategoryProducts() sku small_image { url, label } thumbnail { url, label } - special_from_date special_price special_to_date swatch_image @@ -422,17 +417,8 @@ public function testCategoryProducts() website_id } type_id - updated_at url_key url_path - websites { - id - name - code - sort_order - default_group_id - is_default - } } } } @@ -453,7 +439,6 @@ public function testCategoryProducts() $firstProductModel = $productRepository->get($firstProduct['sku'], false, null, true); $this->assertBaseFields($firstProductModel, $firstProduct); $this->assertAttributes($firstProduct); - $this->assertWebsites($firstProductModel, $firstProduct['websites']); $this->assertEquals('Category 1', $firstProduct['categories'][0]['name']); $this->assertEquals('category-1/category-1-1', $firstProduct['categories'][1]['url_path']); $this->assertCount(3, $firstProduct['categories']); @@ -664,8 +649,6 @@ public function categoryImageDataProvider(): array private function assertBaseFields($product, $actualResponse) { $assertionMap = [ - ['response_field' => 'attribute_set_id', 'expected_value' => $product->getAttributeSetId()], - ['response_field' => 'created_at', 'expected_value' => $product->getCreatedAt()], ['response_field' => 'name', 'expected_value' => $product->getName()], ['response_field' => 'price', 'expected_value' => [ 'minimalPrice' => [ @@ -693,30 +676,10 @@ private function assertBaseFields($product, $actualResponse) ], ['response_field' => 'sku', 'expected_value' => $product->getSku()], ['response_field' => 'type_id', 'expected_value' => $product->getTypeId()], - ['response_field' => 'updated_at', 'expected_value' => $product->getUpdatedAt()], ]; $this->assertResponseFields($actualResponse, $assertionMap); } - /** - * @param ProductInterface $product - * @param array $actualResponse - */ - private function assertWebsites($product, $actualResponse) - { - $assertionMap = [ - [ - 'id' => current($product->getExtensionAttributes()->getWebsiteIds()), - 'name' => 'Main Website', - 'code' => 'base', - 'sort_order' => 0, - 'default_group_id' => '1', - 'is_default' => true, - ] - ]; - $this->assertEquals($actualResponse, $assertionMap); - } - /** * @param array $actualResponse */ @@ -731,11 +694,8 @@ private function assertAttributes($actualResponse) 'short_description', 'country_of_manufacture', 'gift_message_available', - 'new_from_date', - 'new_to_date', 'options_container', 'special_price', - 'special_from_date', 'special_to_date', ]; foreach ($eavAttributes as $eavAttribute) { diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/CategoryTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/CategoryTest.php index f086a2211b51d..b8d2a8cf4b0d0 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/CategoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/CategoryTest.php @@ -333,9 +333,7 @@ public function testCategoryProducts() page_size } items { - attribute_set_id country_of_manufacture - created_at description { html } @@ -374,8 +372,6 @@ public function testCategoryProducts() } } name - new_from_date - new_to_date options_container price { minimalPrice { @@ -434,7 +430,6 @@ public function testCategoryProducts() sku small_image { url, label } thumbnail { url, label } - special_from_date special_price special_to_date swatch_image @@ -447,17 +442,8 @@ public function testCategoryProducts() website_id } type_id - updated_at url_key url_path - websites { - id - name - code - sort_order - default_group_id - is_default - } } } } @@ -478,7 +464,6 @@ public function testCategoryProducts() $firstProduct = $productRepository->get($firstProductSku, false, null, true); $this->assertBaseFields($firstProduct, $response['category']['products']['items'][0]); $this->assertAttributes($response['category']['products']['items'][0]); - $this->assertWebsites($firstProduct, $response['category']['products']['items'][0]['websites']); } /** @@ -688,8 +673,6 @@ public function categoryImageDataProvider(): array private function assertBaseFields($product, $actualResponse) { $assertionMap = [ - ['response_field' => 'attribute_set_id', 'expected_value' => $product->getAttributeSetId()], - ['response_field' => 'created_at', 'expected_value' => $product->getCreatedAt()], ['response_field' => 'name', 'expected_value' => $product->getName()], ['response_field' => 'price', 'expected_value' => [ 'minimalPrice' => [ @@ -717,30 +700,10 @@ private function assertBaseFields($product, $actualResponse) ], ['response_field' => 'sku', 'expected_value' => $product->getSku()], ['response_field' => 'type_id', 'expected_value' => $product->getTypeId()], - ['response_field' => 'updated_at', 'expected_value' => $product->getUpdatedAt()], ]; $this->assertResponseFields($actualResponse, $assertionMap); } - /** - * @param ProductInterface $product - * @param array $actualResponse - */ - private function assertWebsites($product, $actualResponse) - { - $assertionMap = [ - [ - 'id' => current($product->getExtensionAttributes()->getWebsiteIds()), - 'name' => 'Main Website', - 'code' => 'base', - 'sort_order' => 0, - 'default_group_id' => '1', - 'is_default' => true, - ] - ]; - $this->assertEquals($actualResponse, $assertionMap); - } - /** * @param array $actualResponse */ @@ -755,12 +718,8 @@ private function assertAttributes($actualResponse) 'short_description', 'country_of_manufacture', 'gift_message_available', - 'new_from_date', - 'new_to_date', 'options_container', - 'special_price', - 'special_from_date', - 'special_to_date', + 'special_price' ]; foreach ($eavAttributes as $eavAttribute) { $this->assertArrayHasKey($eavAttribute, $actualResponse); diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductViewTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductViewTest.php index 9946e74a24994..a05cca6920a5c 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductViewTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductViewTest.php @@ -45,9 +45,7 @@ public function testQueryAllFieldsSimpleProduct() products(filter: {sku: {eq: "{$productSku}"}}) { items { - attribute_set_id country_of_manufacture - created_at gift_message_available id categories { @@ -86,8 +84,6 @@ public function testQueryAllFieldsSimpleProduct() } } name - new_from_date - new_to_date options_container ... on CustomizableProductInterface { options { @@ -229,10 +225,9 @@ public function testQueryAllFieldsSimpleProduct() sku small_image{ url, label } thumbnail { url, label } - special_from_date special_price special_to_date - swatch_image + swatch_image tier_price tier_prices { @@ -243,11 +238,9 @@ public function testQueryAllFieldsSimpleProduct() website_id } type_id - updated_at url_key url_path canonical_url - websites { id name code sort_order default_group_id is_default } ... on PhysicalProductInterface { weight } @@ -276,8 +269,6 @@ public function testQueryAllFieldsSimpleProduct() $this->assertBaseFields($product, $response['products']['items'][0]); $this->assertEavAttributes($product, $response['products']['items'][0]); $this->assertOptions($product, $response['products']['items'][0]); - $this->assertArrayHasKey('websites', $response['products']['items'][0]); - $this->assertWebsites($product, $response['products']['items'][0]['websites']); self::assertEquals( 'Movable Position 2', $responseObject->getData('products/items/0/categories/0/name') @@ -303,13 +294,11 @@ public function testQueryMediaGalleryEntryFieldsSimpleProduct() products(filter: {sku: {eq: "{$productSku}"}}) { items{ - attribute_set_id categories { id } country_of_manufacture - created_at gift_message_available id image {url, label} @@ -342,8 +331,6 @@ public function testQueryMediaGalleryEntryFieldsSimpleProduct() } } name - new_from_date - new_to_date options_container ... on CustomizableProductInterface { field_options: options { @@ -462,7 +449,6 @@ public function testQueryMediaGalleryEntryFieldsSimpleProduct() } sku small_image { url, label } - special_from_date special_price special_to_date swatch_image @@ -477,10 +463,8 @@ public function testQueryMediaGalleryEntryFieldsSimpleProduct() website_id } type_id - updated_at url_key url_path - websites { id name code sort_order default_group_id is_default } ... on PhysicalProductInterface { weight } @@ -501,8 +485,6 @@ public function testQueryMediaGalleryEntryFieldsSimpleProduct() $this->assertCount(1, $response['products']['items']); $this->assertArrayHasKey(0, $response['products']['items']); $this->assertMediaGalleryEntries($product, $response['products']['items'][0]); - $this->assertArrayHasKey('websites', $response['products']['items'][0]); - $this->assertWebsites($product, $response['products']['items'][0]['websites']); } /** @@ -548,7 +530,6 @@ public function testProductLinks() products(filter: {sku: {eq: "{$productSku}"}}) { items { - attribute_set_id type_id product_links { @@ -585,8 +566,6 @@ public function testProductPrices() products(filter: {price: {from: "150.0", to: "250.0"}}) { items { - attribute_set_id - created_at id name price { @@ -635,7 +614,6 @@ public function testProductPrices() } sku type_id - updated_at ... on PhysicalProductInterface { weight } @@ -815,8 +793,6 @@ private function assertBaseFields($product, $actualResponse) { $assertionMap = [ - ['response_field' => 'attribute_set_id', 'expected_value' => $product->getAttributeSetId()], - ['response_field' => 'created_at', 'expected_value' => $product->getCreatedAt()], ['response_field' => 'id', 'expected_value' => $product->getId()], ['response_field' => 'name', 'expected_value' => $product->getName()], ['response_field' => 'price', 'expected_value' => @@ -846,33 +822,12 @@ private function assertBaseFields($product, $actualResponse) ], ['response_field' => 'sku', 'expected_value' => $product->getSku()], ['response_field' => 'type_id', 'expected_value' => $product->getTypeId()], - ['response_field' => 'updated_at', 'expected_value' => $product->getUpdatedAt()], ['response_field' => 'weight', 'expected_value' => $product->getWeight()], ]; $this->assertResponseFields($actualResponse, $assertionMap); } - /** - * @param ProductInterface $product - * @param array $actualResponse - */ - private function assertWebsites($product, $actualResponse) - { - $assertionMap = [ - [ - 'id' => current($product->getExtensionAttributes()->getWebsiteIds()), - 'name' => 'Main Website', - 'code' => 'base', - 'sort_order' => 0, - 'default_group_id' => '1', - 'is_default' => true, - ] - ]; - - $this->assertEquals($actualResponse, $assertionMap); - } - /** * @param ProductInterface $product * @param array $actualResponse @@ -905,10 +860,8 @@ private function assertEavAttributes($product, $actualResponse) 'meta_title', 'country_of_manufacture', 'gift_message_available', - 'news_from_date', 'options_container', 'special_price', - 'special_from_date', 'special_to_date', ]; $assertionMap = []; @@ -930,14 +883,6 @@ private function assertEavAttributes($product, $actualResponse) */ private function eavAttributesToGraphQlSchemaFieldTranslator(string $eavAttributeCode) { - switch ($eavAttributeCode) { - case 'news_from_date': - $eavAttributeCode = 'new_from_date'; - break; - case 'news_to_date': - $eavAttributeCode = 'new_to_date'; - break; - } return $eavAttributeCode; } @@ -1054,7 +999,7 @@ public function testProductInNonAnchoredSubCategories() $query = << Date: Thu, 29 Oct 2020 12:10:36 +0200 Subject: [PATCH 2/4] CE#30474: Fixed the QueryComplexityLimiterTest tests --- .../Framework/QueryComplexityLimiterTest.php | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Framework/QueryComplexityLimiterTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Framework/QueryComplexityLimiterTest.php index d4296d85724e6..a1e2e90c3f0a1 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Framework/QueryComplexityLimiterTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Framework/QueryComplexityLimiterTest.php @@ -302,6 +302,24 @@ public function testQueryComplexityIsLimited() percentage_value website_id } + tier_prices { + customer_group_id + qty + percentage_value + website_id + } + tier_prices { + customer_group_id + qty + percentage_value + website_id + } + tier_prices { + customer_group_id + qty + percentage_value + website_id + } tier_price manufacturer sku @@ -335,6 +353,16 @@ public function testQueryComplexityIsLimited() position position position + position + position + position + position + position + position + position + position + position + position level url_key url_path From ebe6c10b35eb9bec682784b167947c6c1f6f8b2b Mon Sep 17 00:00:00 2001 From: Andrii Beziazychnyi Date: Mon, 2 Nov 2020 20:33:55 +0200 Subject: [PATCH 3/4] CE#30625: The fields of the `CategoryInterface` have been deprecated - created_at - updated_at Also, the tests have been fixed --- .../Magento/CatalogGraphQl/etc/schema.graphqls | 4 ++-- .../GraphQl/Bundle/BundleProductViewTest.php | 13 +++++-------- .../GraphQl/Catalog/ProductDeleteTest.php | 2 +- .../Catalog/ProductInMultipleStoresTest.php | 3 --- .../GraphQl/Catalog/ProductSearchTest.php | 12 ------------ .../GraphQl/Catalog/VirtualProductViewTest.php | 18 ++++-------------- .../ConfigurableProductViewTest.php | 9 --------- .../DownloadableProductViewTest.php | 6 ------ .../GroupedProduct/GroupedProductViewTest.php | 2 -- .../GraphQl/GroupedProduct/ProductViewTest.php | 8 +++----- .../ProductInMultipleStoresCacheTest.php | 9 --------- .../RelatedProduct/GetRelatedProductsTest.php | 18 ++++-------------- .../Magento/GraphQl/Tax/ProductViewTest.php | 6 ------ 13 files changed, 19 insertions(+), 91 deletions(-) diff --git a/app/code/Magento/CatalogGraphQl/etc/schema.graphqls b/app/code/Magento/CatalogGraphQl/etc/schema.graphqls index 7c52f2ff959b2..818500b276ba9 100644 --- a/app/code/Magento/CatalogGraphQl/etc/schema.graphqls +++ b/app/code/Magento/CatalogGraphQl/etc/schema.graphqls @@ -249,8 +249,8 @@ interface CategoryInterface @typeResolver(class: "Magento\\CatalogGraphQl\\Model canonical_url: String @doc(description: "Relative canonical URL. This value is returned only if the system setting 'Use Canonical Link Meta Tag For Categories' is enabled") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Category\\CanonicalUrl") position: Int @doc(description: "The position of the category relative to other categories at the same level in tree.") level: Int @doc(description: "Indicates the depth of the category within the tree.") - created_at: String @doc(description: "Timestamp indicating when the category was created.") - updated_at: String @doc(description: "Timestamp indicating when the category was updated.") + created_at: String @deprecated(reason: "The field should not be used on the storefront.") @doc(description: "Timestamp indicating when the category was created.") + updated_at: String @deprecated(reason: "The field should not be used on the storefront.") @doc(description: "Timestamp indicating when the category was updated.") product_count: Int @doc(description: "The number of products in the category that are marked as visible. By default, in complex products, parent products are visible, but their child products are not.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Category\\ProductsCount") default_sort_by: String @doc(description: "The attribute to use for sorting.") products( diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Bundle/BundleProductViewTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Bundle/BundleProductViewTest.php index a18b6e1206895..bc3fcd3a8427b 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Bundle/BundleProductViewTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Bundle/BundleProductViewTest.php @@ -38,7 +38,6 @@ public function testAllFieldsBundleProducts() type_id id name - attribute_set_id ... on PhysicalProductInterface { weight } @@ -54,7 +53,7 @@ public function testAllFieldsBundleProducts() required type position - sku + sku options { id quantity @@ -74,7 +73,7 @@ public function testAllFieldsBundleProducts() } } } - } + } } QUERY; @@ -118,7 +117,6 @@ public function testBundleProductWithNotVisibleChildren() type_id id name - attribute_set_id ... on PhysicalProductInterface { weight } @@ -134,7 +132,7 @@ public function testBundleProductWithNotVisibleChildren() required type position - sku + sku options { id quantity @@ -154,7 +152,7 @@ public function testBundleProductWithNotVisibleChildren() } } } - } + } } QUERY; @@ -207,8 +205,7 @@ private function assertBundleBaseFields($product, $actualResponse) ['response_field' => 'type_id', 'expected_value' => $product->getTypeId()], ['response_field' => 'id', 'expected_value' => $product->getId()], ['response_field' => 'name', 'expected_value' => $product->getName()], - ['response_field' => 'attribute_set_id', 'expected_value' => $product->getAttributeSetId()], - ['response_field' => 'weight', 'expected_value' => $product->getWeight()], + ['response_field' => 'weight', 'expected_value' => $product->getWeight()], ['response_field' => 'dynamic_price', 'expected_value' => !(bool)$product->getPriceType()], ['response_field' => 'dynamic_weight', 'expected_value' => !(bool)$product->getWeightType()], ['response_field' => 'dynamic_sku', 'expected_value' => !(bool)$product->getSkuType()] diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductDeleteTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductDeleteTest.php index b19b8d519e857..ab04333de0740 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductDeleteTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductDeleteTest.php @@ -39,7 +39,7 @@ public function testQuerySimpleProductAfterDelete() products(filter: {sku: {eq: "{$productSku}"}}) { items { - attribute_set_id + id } } } diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductInMultipleStoresTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductInMultipleStoresTest.php index d17b434f39d9f..f91f4938624cf 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductInMultipleStoresTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductInMultipleStoresTest.php @@ -31,8 +31,6 @@ public function testProductFromSpecificAndDefaultStore() products(filter: {sku: {eq: "{$productSku}"}}) { items { - attribute_set_id - created_at id name price { @@ -45,7 +43,6 @@ public function testProductFromSpecificAndDefaultStore() } sku type_id - updated_at ... on PhysicalProductInterface { weight } diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductSearchTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductSearchTest.php index 62620330f6e7b..45f1d3c5e57cb 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductSearchTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductSearchTest.php @@ -1086,7 +1086,6 @@ public function testFilterWithinSpecificPriceRangeSortedByNameDesc() weight } type_id - attribute_set_id } total_count page_info @@ -1239,7 +1238,6 @@ public function testSearchWithFilterWithPageSizeEqualTotalCount() weight } type_id - attribute_set_id } total_count page_info @@ -1303,7 +1301,6 @@ public function testFilterByMultipleFilterFieldsSortedByMultipleSortFields() weight } type_id - attribute_set_id } total_count page_info @@ -1682,7 +1679,6 @@ public function testFilterByExactSkuAndSortByPriceDesc() weight } type_id - attribute_set_id } total_count page_info @@ -2108,7 +2104,6 @@ public function testFilterWithinASpecificPriceRangeSortedByPriceDESC() { items { - attribute_set_id sku price { minimalPrice { @@ -2208,7 +2203,6 @@ public function testQueryFilterNoMatchingItems() weight } type_id - attribute_set_id } total_count page_info @@ -2265,7 +2259,6 @@ public function testQueryPageOutOfBoundException() ... on PhysicalProductInterface { weight } - attribute_set_id } total_count page_info @@ -2298,12 +2291,9 @@ public function testQueryWithNoSearchOrFilterArgumentException() { items{ id - attribute_set_id - created_at name sku type_id - updated_at ... on PhysicalProductInterface { weight } @@ -2448,7 +2438,6 @@ private function assertProductItems(array $filteredProducts, array $actualRespon $this->assertResponseFields( $productItemsInResponse[$itemIndex][0], [ - 'attribute_set_id' => $filteredProducts[$itemIndex]->getAttributeSetId(), 'sku' => $filteredProducts[$itemIndex]->getSku(), 'name' => $filteredProducts[$itemIndex]->getName(), 'price' => [ @@ -2475,7 +2464,6 @@ private function assertProductItemsWithPriceCheck(array $filteredProducts, array $this->assertResponseFields( $productItemsInResponse[$itemIndex][0], [ - 'attribute_set_id' => $filteredProducts[$itemIndex]->getAttributeSetId(), 'sku' => $filteredProducts[$itemIndex]->getSku(), 'name' => $filteredProducts[$itemIndex]->getName(), 'price' => [ diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/VirtualProductViewTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/VirtualProductViewTest.php index 00f0c496d8ea4..0661ca04e3b49 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/VirtualProductViewTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/VirtualProductViewTest.php @@ -30,21 +30,16 @@ public function testQueryAllFieldsVirtualProduct() { items{ id - attribute_set_id - created_at name sku type_id - updated_at ... on PhysicalProductInterface { weight - } + } ... on VirtualProduct { - attribute_set_id name id sku - } } } @@ -84,24 +79,20 @@ public function testCannotQueryWeightOnVirtualProductException() { items{ id - attribute_set_id - created_at name sku type_id - updated_at ... on PhysicalProductInterface { weight - } + } ... on VirtualProduct { - attribute_set_id name weight id - sku + sku } } - } + } } QUERY; @@ -119,7 +110,6 @@ public function testCannotQueryWeightOnVirtualProductException() private function assertBaseFields($product, $actualResponse) { $assertionMap = [ - ['response_field' => 'attribute_set_id', 'expected_value' => $product->getAttributeSetId()], ['response_field' => 'id', 'expected_value' => $product->getId()], ['response_field' => 'name', 'expected_value' => $product->getName()], ['response_field' => 'sku', 'expected_value' => $product->getSku()], diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/ConfigurableProduct/ConfigurableProductViewTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/ConfigurableProduct/ConfigurableProductViewTest.php index 49bbabc212fc2..a5431efefdde3 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/ConfigurableProduct/ConfigurableProductViewTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/ConfigurableProduct/ConfigurableProductViewTest.php @@ -39,12 +39,9 @@ public function testQueryConfigurableProductLinks() products(filter: {sku: {eq: "{$productSku}"}}) { items { id - attribute_set_id - created_at name sku type_id - updated_at ... on PhysicalProductInterface { weight } @@ -115,12 +112,9 @@ public function testQueryConfigurableProductLinks() id name sku - attribute_set_id ... on PhysicalProductInterface { weight } - created_at - updated_at price { minimalPrice { amount { @@ -237,8 +231,6 @@ private function assertBaseFields($product, $actualResponse) /** @var MetadataPool $metadataPool */ $metadataPool = ObjectManager::getInstance()->get(MetadataPool::class); $assertionMap = [ - ['response_field' => 'attribute_set_id', 'expected_value' => $product->getAttributeSetId()], - ['response_field' => 'created_at', 'expected_value' => $product->getCreatedAt()], [ 'response_field' => 'id', 'expected_value' => $product->getData( @@ -250,7 +242,6 @@ private function assertBaseFields($product, $actualResponse) ['response_field' => 'name', 'expected_value' => $product->getName()], ['response_field' => 'sku', 'expected_value' => $product->getSku()], ['response_field' => 'type_id', 'expected_value' => $product->getTypeId()], - ['response_field' => 'updated_at', 'expected_value' => $product->getUpdatedAt()], ['response_field' => 'weight', 'expected_value' => $product->getWeight()], [ 'response_field' => 'price', diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/DownloadableProduct/DownloadableProductViewTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/DownloadableProduct/DownloadableProductViewTest.php index c2a1b0778d3c6..774e4dcbdf297 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/DownloadableProduct/DownloadableProductViewTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/DownloadableProduct/DownloadableProductViewTest.php @@ -33,12 +33,9 @@ public function testQueryAllFieldsDownloadableProductsWithDownloadableFileAndSam { items{ id - attribute_set_id - created_at name sku type_id - updated_at price{ regularPrice{ amount{ @@ -110,12 +107,9 @@ public function testDownloadableProductQueryWithNoSample() { items{ id - attribute_set_id - created_at name sku type_id - updated_at ...on PhysicalProductInterface{ weight } diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/GroupedProduct/GroupedProductViewTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/GroupedProduct/GroupedProductViewTest.php index 8cb0a6db972b4..ac893aa10fd55 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/GroupedProduct/GroupedProductViewTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/GroupedProduct/GroupedProductViewTest.php @@ -42,8 +42,6 @@ public function testAllFieldsGroupedProduct() products(filter: {sku: {eq: "{$productSku}"}}) { items { id - attribute_set_id - created_at name sku type_id diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/GroupedProduct/ProductViewTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/GroupedProduct/ProductViewTest.php index 9eea2396c24ce..86ba62f8e41ec 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/GroupedProduct/ProductViewTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/GroupedProduct/ProductViewTest.php @@ -106,13 +106,11 @@ private function getQuery(string $sku): string return << 'attribute_set_id', 'expected_value' => $product->getAttributeSetId()], - ['response_field' => 'created_at', 'expected_value' => $product->getCreatedAt()], ['response_field' => 'id', 'expected_value' => $product->getId()], ['response_field' => 'name', 'expected_value' => $product->getName()], ['response_field' => 'price', 'expected_value' => @@ -345,7 +340,6 @@ private function assertBaseFields($product, $actualResponse) ], ['response_field' => 'sku', 'expected_value' => $product->getSku()], ['response_field' => 'type_id', 'expected_value' => $product->getTypeId()], - ['response_field' => 'updated_at', 'expected_value' => $product->getUpdatedAt()], ['response_field' => 'weight', 'expected_value' => $product->getWeight()], ]; From 3a07a62aadbecc0abbcd1874df329a2d0a5e524d Mon Sep 17 00:00:00 2001 From: Andrii Beziazychnyi Date: Mon, 2 Nov 2020 23:02:04 +0200 Subject: [PATCH 4/4] Fixed the static tests --- .../Magento/GraphQl/Catalog/ProductInMultipleStoresTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductInMultipleStoresTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductInMultipleStoresTest.php index f91f4938624cf..7c7212b9b9b26 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductInMultipleStoresTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductInMultipleStoresTest.php @@ -11,7 +11,7 @@ use Magento\TestFramework\TestCase\GraphQlAbstract; /** - * Class ProductInMultipleStoresTest + * The GraphQl test for product in multiple stores */ class ProductInMultipleStoresTest extends GraphQlAbstract {