Skip to content

Commit ebe6c10

Browse files
andrewbessAndrii Beziazychnyi
authored andcommitted
CE#30625: The fields of the CategoryInterface have been deprecated
- created_at - updated_at Also, the tests have been fixed
1 parent 8479fe2 commit ebe6c10

File tree

13 files changed

+19
-91
lines changed

13 files changed

+19
-91
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,8 @@ interface CategoryInterface @typeResolver(class: "Magento\\CatalogGraphQl\\Model
249249
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")
250250
position: Int @doc(description: "The position of the category relative to other categories at the same level in tree.")
251251
level: Int @doc(description: "Indicates the depth of the category within the tree.")
252-
created_at: String @doc(description: "Timestamp indicating when the category was created.")
253-
updated_at: String @doc(description: "Timestamp indicating when the category was updated.")
252+
created_at: String @deprecated(reason: "The field should not be used on the storefront.") @doc(description: "Timestamp indicating when the category was created.")
253+
updated_at: String @deprecated(reason: "The field should not be used on the storefront.") @doc(description: "Timestamp indicating when the category was updated.")
254254
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")
255255
default_sort_by: String @doc(description: "The attribute to use for sorting.")
256256
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/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: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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
}

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

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,7 +1086,6 @@ public function testFilterWithinSpecificPriceRangeSortedByNameDesc()
10861086
weight
10871087
}
10881088
type_id
1089-
attribute_set_id
10901089
}
10911090
total_count
10921091
page_info
@@ -1239,7 +1238,6 @@ public function testSearchWithFilterWithPageSizeEqualTotalCount()
12391238
weight
12401239
}
12411240
type_id
1242-
attribute_set_id
12431241
}
12441242
total_count
12451243
page_info
@@ -1303,7 +1301,6 @@ public function testFilterByMultipleFilterFieldsSortedByMultipleSortFields()
13031301
weight
13041302
}
13051303
type_id
1306-
attribute_set_id
13071304
}
13081305
total_count
13091306
page_info
@@ -1682,7 +1679,6 @@ public function testFilterByExactSkuAndSortByPriceDesc()
16821679
weight
16831680
}
16841681
type_id
1685-
attribute_set_id
16861682
}
16871683
total_count
16881684
page_info
@@ -2108,7 +2104,6 @@ public function testFilterWithinASpecificPriceRangeSortedByPriceDESC()
21082104
{
21092105
items
21102106
{
2111-
attribute_set_id
21122107
sku
21132108
price {
21142109
minimalPrice {
@@ -2208,7 +2203,6 @@ public function testQueryFilterNoMatchingItems()
22082203
weight
22092204
}
22102205
type_id
2211-
attribute_set_id
22122206
}
22132207
total_count
22142208
page_info
@@ -2265,7 +2259,6 @@ public function testQueryPageOutOfBoundException()
22652259
... on PhysicalProductInterface {
22662260
weight
22672261
}
2268-
attribute_set_id
22692262
}
22702263
total_count
22712264
page_info
@@ -2298,12 +2291,9 @@ public function testQueryWithNoSearchOrFilterArgumentException()
22982291
{
22992292
items{
23002293
id
2301-
attribute_set_id
2302-
created_at
23032294
name
23042295
sku
23052296
type_id
2306-
updated_at
23072297
... on PhysicalProductInterface {
23082298
weight
23092299
}
@@ -2448,7 +2438,6 @@ private function assertProductItems(array $filteredProducts, array $actualRespon
24482438
$this->assertResponseFields(
24492439
$productItemsInResponse[$itemIndex][0],
24502440
[
2451-
'attribute_set_id' => $filteredProducts[$itemIndex]->getAttributeSetId(),
24522441
'sku' => $filteredProducts[$itemIndex]->getSku(),
24532442
'name' => $filteredProducts[$itemIndex]->getName(),
24542443
'price' => [
@@ -2475,7 +2464,6 @@ private function assertProductItemsWithPriceCheck(array $filteredProducts, array
24752464
$this->assertResponseFields(
24762465
$productItemsInResponse[$itemIndex][0],
24772466
[
2478-
'attribute_set_id' => $filteredProducts[$itemIndex]->getAttributeSetId(),
24792467
'sku' => $filteredProducts[$itemIndex]->getSku(),
24802468
'name' => $filteredProducts[$itemIndex]->getName(),
24812469
'price' => [

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

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,16 @@ public function testQueryAllFieldsVirtualProduct()
3030
{
3131
items{
3232
id
33-
attribute_set_id
34-
created_at
3533
name
3634
sku
3735
type_id
38-
updated_at
3936
... on PhysicalProductInterface {
4037
weight
41-
}
38+
}
4239
... on VirtualProduct {
43-
attribute_set_id
4440
name
4541
id
4642
sku
47-
4843
}
4944
}
5045
}
@@ -84,24 +79,20 @@ public function testCannotQueryWeightOnVirtualProductException()
8479
{
8580
items{
8681
id
87-
attribute_set_id
88-
created_at
8982
name
9083
sku
9184
type_id
92-
updated_at
9385
... on PhysicalProductInterface {
9486
weight
95-
}
87+
}
9688
... on VirtualProduct {
97-
attribute_set_id
9889
name
9990
weight
10091
id
101-
sku
92+
sku
10293
}
10394
}
104-
}
95+
}
10596
}
10697
QUERY;
10798

@@ -119,7 +110,6 @@ public function testCannotQueryWeightOnVirtualProductException()
119110
private function assertBaseFields($product, $actualResponse)
120111
{
121112
$assertionMap = [
122-
['response_field' => 'attribute_set_id', 'expected_value' => $product->getAttributeSetId()],
123113
['response_field' => 'id', 'expected_value' => $product->getId()],
124114
['response_field' => 'name', 'expected_value' => $product->getName()],
125115
['response_field' => 'sku', 'expected_value' => $product->getSku()],

dev/tests/api-functional/testsuite/Magento/GraphQl/ConfigurableProduct/ConfigurableProductViewTest.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,9 @@ public function testQueryConfigurableProductLinks()
3939
products(filter: {sku: {eq: "{$productSku}"}}) {
4040
items {
4141
id
42-
attribute_set_id
43-
created_at
4442
name
4543
sku
4644
type_id
47-
updated_at
4845
... on PhysicalProductInterface {
4946
weight
5047
}
@@ -115,12 +112,9 @@ public function testQueryConfigurableProductLinks()
115112
id
116113
name
117114
sku
118-
attribute_set_id
119115
... on PhysicalProductInterface {
120116
weight
121117
}
122-
created_at
123-
updated_at
124118
price {
125119
minimalPrice {
126120
amount {
@@ -237,8 +231,6 @@ private function assertBaseFields($product, $actualResponse)
237231
/** @var MetadataPool $metadataPool */
238232
$metadataPool = ObjectManager::getInstance()->get(MetadataPool::class);
239233
$assertionMap = [
240-
['response_field' => 'attribute_set_id', 'expected_value' => $product->getAttributeSetId()],
241-
['response_field' => 'created_at', 'expected_value' => $product->getCreatedAt()],
242234
[
243235
'response_field' => 'id',
244236
'expected_value' => $product->getData(
@@ -250,7 +242,6 @@ private function assertBaseFields($product, $actualResponse)
250242
['response_field' => 'name', 'expected_value' => $product->getName()],
251243
['response_field' => 'sku', 'expected_value' => $product->getSku()],
252244
['response_field' => 'type_id', 'expected_value' => $product->getTypeId()],
253-
['response_field' => 'updated_at', 'expected_value' => $product->getUpdatedAt()],
254245
['response_field' => 'weight', 'expected_value' => $product->getWeight()],
255246
[
256247
'response_field' => 'price',

dev/tests/api-functional/testsuite/Magento/GraphQl/DownloadableProduct/DownloadableProductViewTest.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,9 @@ public function testQueryAllFieldsDownloadableProductsWithDownloadableFileAndSam
3333
{
3434
items{
3535
id
36-
attribute_set_id
37-
created_at
3836
name
3937
sku
4038
type_id
41-
updated_at
4239
price{
4340
regularPrice{
4441
amount{
@@ -110,12 +107,9 @@ public function testDownloadableProductQueryWithNoSample()
110107
{
111108
items{
112109
id
113-
attribute_set_id
114-
created_at
115110
name
116111
sku
117112
type_id
118-
updated_at
119113
...on PhysicalProductInterface{
120114
weight
121115
}

dev/tests/api-functional/testsuite/Magento/GraphQl/GroupedProduct/GroupedProductViewTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ public function testAllFieldsGroupedProduct()
4242
products(filter: {sku: {eq: "{$productSku}"}}) {
4343
items {
4444
id
45-
attribute_set_id
46-
created_at
4745
name
4846
sku
4947
type_id

dev/tests/api-functional/testsuite/Magento/GraphQl/GroupedProduct/ProductViewTest.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,11 @@ private function getQuery(string $sku): string
106106
return <<<QUERY
107107
{
108108
products(filter: {sku: {eq: "{$sku}"}}) {
109-
items {
109+
items {
110110
id
111-
attribute_set_id
112-
created_at
113111
name
114112
sku
115-
type_id
113+
type_id
116114
... on GroupedProduct {
117115
items{
118116
qty
@@ -121,7 +119,7 @@ private function getQuery(string $sku): string
121119
sku
122120
name
123121
type_id
124-
url_key
122+
url_key
125123
}
126124
}
127125
}

0 commit comments

Comments
 (0)