Skip to content

Commit df831fe

Browse files
committed
Merge remote-tracking branch 'andrewbess/graphql/CE-30625' into HB-PR-delivery-Dec
2 parents d156776 + 3a07a62 commit df831fe

File tree

17 files changed

+55
-260
lines changed

17 files changed

+55
-260
lines changed

app/code/Magento/CatalogGraphQl/etc/schema.graphqls

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,21 +90,21 @@ interface ProductInterface @typeResolver(class: "Magento\\CatalogGraphQl\\Model\
9090
description: ComplexTextValue @doc(description: "Detailed information about the product. The value can include simple HTML tags.") @resolver(class: "\\Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\ProductComplexTextAttribute")
9191
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")
9292
special_price: Float @doc(description: "The discounted price of the product.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\SpecialPrice")
93-
special_from_date: String @doc(description: "The beginning date that a product has a special price.")
93+
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.")
9494
special_to_date: String @doc(description: "The end date that a product has a special price.")
95-
attribute_set_id: Int @doc(description: "The attribute set assigned to the product.")
95+
attribute_set_id: Int @deprecated(reason: "The field should not be used on the storefront.") @doc(description: "The attribute set assigned to the product.")
9696
meta_title: String @doc(description: "A string that is displayed in the title bar and tab of the browser and in search results lists.")
9797
meta_keyword: String @doc(description: "A comma-separated list of keywords that are visible only to search engines.")
9898
meta_description: String @doc(description: "A brief overview of the product for search results listings, maximum 255 characters.")
9999
image: ProductImage @doc(description: "The relative path to the main image on the product page.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\ProductImage")
100100
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")
101101
thumbnail: ProductImage @doc(description: "The relative path to the product's thumbnail image.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\ProductImage")
102-
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")
103-
new_to_date: String @doc(description: "The end date for new product listings.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\NewFromTo")
102+
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")
103+
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")
104104
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.")
105105
options_container: String @doc(description: "If the product has multiple options, determines where they appear on the product page.")
106-
created_at: String @doc(description: "Timestamp indicating when the product was created.")
107-
updated_at: String @doc(description: "Timestamp indicating when the product was updated.")
106+
created_at: String @deprecated(reason: "The field should not be used on the storefront.") @doc(description: "Timestamp indicating when the product was created.")
107+
updated_at: String @deprecated(reason: "The field should not be used on the storefront.") @doc(description: "Timestamp indicating when the product was updated.")
108108
country_of_manufacture: String @doc(description: "The product's country of origin.")
109109
type_id: String @doc(description: "One of simple, virtual, bundle, downloadable, grouped, or configurable.") @deprecated(reason: "Use __typename instead.")
110110
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")
@@ -252,8 +252,8 @@ interface CategoryInterface @typeResolver(class: "Magento\\CatalogGraphQl\\Model
252252
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")
253253
position: Int @doc(description: "The position of the category relative to other categories at the same level in tree.")
254254
level: Int @doc(description: "Indicates the depth of the category within the tree.")
255-
created_at: String @doc(description: "Timestamp indicating when the category was created.")
256-
updated_at: String @doc(description: "Timestamp indicating when the category was updated.")
255+
created_at: String @deprecated(reason: "The field should not be used on the storefront.") @doc(description: "Timestamp indicating when the category was created.")
256+
updated_at: String @deprecated(reason: "The field should not be used on the storefront.") @doc(description: "Timestamp indicating when the category was updated.")
257257
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")
258258
default_sort_by: String @doc(description: "The attribute to use for sorting.")
259259
products(

dev/tests/api-functional/testsuite/Magento/GraphQl/Bundle/BundleProductViewTest.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ public function testAllFieldsBundleProducts()
3838
type_id
3939
id
4040
name
41-
attribute_set_id
4241
... on PhysicalProductInterface {
4342
weight
4443
}
@@ -54,7 +53,7 @@ public function testAllFieldsBundleProducts()
5453
required
5554
type
5655
position
57-
sku
56+
sku
5857
options {
5958
id
6059
quantity
@@ -74,7 +73,7 @@ public function testAllFieldsBundleProducts()
7473
}
7574
}
7675
}
77-
}
76+
}
7877
}
7978
QUERY;
8079

@@ -118,7 +117,6 @@ public function testBundleProductWithNotVisibleChildren()
118117
type_id
119118
id
120119
name
121-
attribute_set_id
122120
... on PhysicalProductInterface {
123121
weight
124122
}
@@ -134,7 +132,7 @@ public function testBundleProductWithNotVisibleChildren()
134132
required
135133
type
136134
position
137-
sku
135+
sku
138136
options {
139137
id
140138
quantity
@@ -154,7 +152,7 @@ public function testBundleProductWithNotVisibleChildren()
154152
}
155153
}
156154
}
157-
}
155+
}
158156
}
159157
QUERY;
160158

@@ -207,8 +205,7 @@ private function assertBundleBaseFields($product, $actualResponse)
207205
['response_field' => 'type_id', 'expected_value' => $product->getTypeId()],
208206
['response_field' => 'id', 'expected_value' => $product->getId()],
209207
['response_field' => 'name', 'expected_value' => $product->getName()],
210-
['response_field' => 'attribute_set_id', 'expected_value' => $product->getAttributeSetId()],
211-
['response_field' => 'weight', 'expected_value' => $product->getWeight()],
208+
['response_field' => 'weight', 'expected_value' => $product->getWeight()],
212209
['response_field' => 'dynamic_price', 'expected_value' => !(bool)$product->getPriceType()],
213210
['response_field' => 'dynamic_weight', 'expected_value' => !(bool)$product->getWeightType()],
214211
['response_field' => 'dynamic_sku', 'expected_value' => !(bool)$product->getSkuType()]

dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/CategoriesQuery/CategoryTreeTest.php

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -308,9 +308,7 @@ public function testCategoryProducts()
308308
page_size
309309
}
310310
items {
311-
attribute_set_id
312311
country_of_manufacture
313-
created_at
314312
description {
315313
html
316314
}
@@ -349,8 +347,6 @@ public function testCategoryProducts()
349347
}
350348
}
351349
name
352-
new_from_date
353-
new_to_date
354350
options_container
355351
price {
356352
minimalPrice {
@@ -409,7 +405,6 @@ public function testCategoryProducts()
409405
sku
410406
small_image { url, label }
411407
thumbnail { url, label }
412-
special_from_date
413408
special_price
414409
special_to_date
415410
swatch_image
@@ -422,17 +417,8 @@ public function testCategoryProducts()
422417
website_id
423418
}
424419
type_id
425-
updated_at
426420
url_key
427421
url_path
428-
websites {
429-
id
430-
name
431-
code
432-
sort_order
433-
default_group_id
434-
is_default
435-
}
436422
}
437423
}
438424
}
@@ -453,7 +439,6 @@ public function testCategoryProducts()
453439
$firstProductModel = $productRepository->get($firstProduct['sku'], false, null, true);
454440
$this->assertBaseFields($firstProductModel, $firstProduct);
455441
$this->assertAttributes($firstProduct);
456-
$this->assertWebsites($firstProductModel, $firstProduct['websites']);
457442
$this->assertEquals('Category 1', $firstProduct['categories'][0]['name']);
458443
$this->assertEquals('category-1/category-1-1', $firstProduct['categories'][1]['url_path']);
459444
$this->assertCount(3, $firstProduct['categories']);
@@ -695,8 +680,6 @@ public function categoryImageDataProvider(): array
695680
private function assertBaseFields($product, $actualResponse)
696681
{
697682
$assertionMap = [
698-
['response_field' => 'attribute_set_id', 'expected_value' => $product->getAttributeSetId()],
699-
['response_field' => 'created_at', 'expected_value' => $product->getCreatedAt()],
700683
['response_field' => 'name', 'expected_value' => $product->getName()],
701684
['response_field' => 'price', 'expected_value' => [
702685
'minimalPrice' => [
@@ -724,30 +707,10 @@ private function assertBaseFields($product, $actualResponse)
724707
],
725708
['response_field' => 'sku', 'expected_value' => $product->getSku()],
726709
['response_field' => 'type_id', 'expected_value' => $product->getTypeId()],
727-
['response_field' => 'updated_at', 'expected_value' => $product->getUpdatedAt()],
728710
];
729711
$this->assertResponseFields($actualResponse, $assertionMap);
730712
}
731713

732-
/**
733-
* @param ProductInterface $product
734-
* @param array $actualResponse
735-
*/
736-
private function assertWebsites($product, $actualResponse)
737-
{
738-
$assertionMap = [
739-
[
740-
'id' => current($product->getExtensionAttributes()->getWebsiteIds()),
741-
'name' => 'Main Website',
742-
'code' => 'base',
743-
'sort_order' => 0,
744-
'default_group_id' => '1',
745-
'is_default' => true,
746-
]
747-
];
748-
$this->assertEquals($actualResponse, $assertionMap);
749-
}
750-
751714
/**
752715
* @param array $actualResponse
753716
*/
@@ -762,11 +725,8 @@ private function assertAttributes($actualResponse)
762725
'short_description',
763726
'country_of_manufacture',
764727
'gift_message_available',
765-
'new_from_date',
766-
'new_to_date',
767728
'options_container',
768729
'special_price',
769-
'special_from_date',
770730
'special_to_date',
771731
];
772732
foreach ($eavAttributes as $eavAttribute) {

dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/CategoryTest.php

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -333,9 +333,7 @@ public function testCategoryProducts()
333333
page_size
334334
}
335335
items {
336-
attribute_set_id
337336
country_of_manufacture
338-
created_at
339337
description {
340338
html
341339
}
@@ -374,8 +372,6 @@ public function testCategoryProducts()
374372
}
375373
}
376374
name
377-
new_from_date
378-
new_to_date
379375
options_container
380376
price {
381377
minimalPrice {
@@ -434,7 +430,6 @@ public function testCategoryProducts()
434430
sku
435431
small_image { url, label }
436432
thumbnail { url, label }
437-
special_from_date
438433
special_price
439434
special_to_date
440435
swatch_image
@@ -447,17 +442,8 @@ public function testCategoryProducts()
447442
website_id
448443
}
449444
type_id
450-
updated_at
451445
url_key
452446
url_path
453-
websites {
454-
id
455-
name
456-
code
457-
sort_order
458-
default_group_id
459-
is_default
460-
}
461447
}
462448
}
463449
}
@@ -478,7 +464,6 @@ public function testCategoryProducts()
478464
$firstProduct = $productRepository->get($firstProductSku, false, null, true);
479465
$this->assertBaseFields($firstProduct, $response['category']['products']['items'][0]);
480466
$this->assertAttributes($response['category']['products']['items'][0]);
481-
$this->assertWebsites($firstProduct, $response['category']['products']['items'][0]['websites']);
482467
}
483468

484469
/**
@@ -732,8 +717,6 @@ public function categoryImageDataProvider(): array
732717
private function assertBaseFields($product, $actualResponse)
733718
{
734719
$assertionMap = [
735-
['response_field' => 'attribute_set_id', 'expected_value' => $product->getAttributeSetId()],
736-
['response_field' => 'created_at', 'expected_value' => $product->getCreatedAt()],
737720
['response_field' => 'name', 'expected_value' => $product->getName()],
738721
['response_field' => 'price', 'expected_value' => [
739722
'minimalPrice' => [
@@ -761,30 +744,10 @@ private function assertBaseFields($product, $actualResponse)
761744
],
762745
['response_field' => 'sku', 'expected_value' => $product->getSku()],
763746
['response_field' => 'type_id', 'expected_value' => $product->getTypeId()],
764-
['response_field' => 'updated_at', 'expected_value' => $product->getUpdatedAt()],
765747
];
766748
$this->assertResponseFields($actualResponse, $assertionMap);
767749
}
768750

769-
/**
770-
* @param ProductInterface $product
771-
* @param array $actualResponse
772-
*/
773-
private function assertWebsites($product, $actualResponse)
774-
{
775-
$assertionMap = [
776-
[
777-
'id' => current($product->getExtensionAttributes()->getWebsiteIds()),
778-
'name' => 'Main Website',
779-
'code' => 'base',
780-
'sort_order' => 0,
781-
'default_group_id' => '1',
782-
'is_default' => true,
783-
]
784-
];
785-
$this->assertEquals($actualResponse, $assertionMap);
786-
}
787-
788751
/**
789752
* @param array $actualResponse
790753
*/
@@ -799,12 +762,8 @@ private function assertAttributes($actualResponse)
799762
'short_description',
800763
'country_of_manufacture',
801764
'gift_message_available',
802-
'new_from_date',
803-
'new_to_date',
804765
'options_container',
805-
'special_price',
806-
'special_from_date',
807-
'special_to_date',
766+
'special_price'
808767
];
809768
foreach ($eavAttributes as $eavAttribute) {
810769
$this->assertArrayHasKey($eavAttribute, $actualResponse);

dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductDeleteTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function testQuerySimpleProductAfterDelete()
3939
products(filter: {sku: {eq: "{$productSku}"}})
4040
{
4141
items {
42-
attribute_set_id
42+
id
4343
}
4444
}
4545
}

dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductInMultipleStoresTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use Magento\TestFramework\TestCase\GraphQlAbstract;
1212

1313
/**
14-
* Class ProductInMultipleStoresTest
14+
* The GraphQl test for product in multiple stores
1515
*/
1616
class ProductInMultipleStoresTest extends GraphQlAbstract
1717
{
@@ -31,8 +31,6 @@ public function testProductFromSpecificAndDefaultStore()
3131
products(filter: {sku: {eq: "{$productSku}"}})
3232
{
3333
items {
34-
attribute_set_id
35-
created_at
3634
id
3735
name
3836
price {
@@ -45,7 +43,6 @@ public function testProductFromSpecificAndDefaultStore()
4543
}
4644
sku
4745
type_id
48-
updated_at
4946
... on PhysicalProductInterface {
5047
weight
5148
}

0 commit comments

Comments
 (0)