@@ -28,50 +28,48 @@ public function testAllFielsBundleProducts()
28
28
products(filter: {sku: {eq: " {$ productSku }"}})
29
29
{
30
30
items{
31
- id
32
- attribute_set_id
33
- created_at
34
- name
35
31
sku
36
32
type_id
37
- updated_at
33
+ id
34
+ name
35
+ attribute_set_id
38
36
... on PhysicalProductInterface {
39
37
weight
40
38
}
41
- category_ids
39
+ category_ids
42
40
... on BundleProduct {
43
41
dynamic_sku
44
42
dynamic_price
45
43
dynamic_weight
46
44
price_view
47
45
ship_bundle_items
48
- items {
49
- option_id
50
- title
51
- required
52
- type
53
- position
54
- sku
55
- options {
56
- id
57
- product_id
58
- qty
59
- position
60
- is_default
61
- price
62
- price_type
63
- can_change_quantity
64
- product {
65
- id
66
- name
67
- sku
68
- }
69
- }
70
- }
46
+ items {
47
+ option_id
48
+ title
49
+ required
50
+ type
51
+ position
52
+ sku
53
+ options {
54
+ id
55
+ qty
56
+ position
57
+ is_default
58
+ price
59
+ price_type
60
+ can_change_quantity
61
+ label
62
+ product {
63
+ id
64
+ name
65
+ sku
66
+ type_id
67
+ }
68
+ }
69
+ }
71
70
}
72
71
}
73
- }
74
-
72
+ }
75
73
}
76
74
QUERY ;
77
75
@@ -109,6 +107,9 @@ private function assertBundleBaseFields($product, $actualResponse)
109
107
['response_field ' => 'sku ' , 'expected_value ' => $ product ->getSku ()],
110
108
['response_field ' => 'type_id ' , 'expected_value ' => $ product ->getTypeId ()],
111
109
['response_field ' => 'id ' , 'expected_value ' => $ product ->getId ()],
110
+ ['response_field ' => 'name ' , 'expected_value ' => $ product ->getName ()],
111
+ ['response_field ' => 'attribute_set_id ' , 'expected_value ' => $ product ->getAttributeSetId ()],
112
+ ['response_field ' => 'weight ' , 'expected_value ' => $ product ->getWeight ()],
112
113
['response_field ' => 'dynamic_price ' , 'expected_value ' => !(bool )$ product ->getPriceType ()],
113
114
['response_field ' => 'dynamic_weight ' , 'expected_value ' => !(bool )$ product ->getWeightType ()],
114
115
['response_field ' => 'dynamic_sku ' , 'expected_value ' => !(bool )$ product ->getSkuType ()]
@@ -133,6 +134,9 @@ private function assertBundleProductOptions($product, $actualResponse)
133
134
$ option = $ options [0 ];
134
135
$ bundleProductLinks = $ option ->getProductLinks ();
135
136
$ bundleProductLink = $ bundleProductLinks [0 ];
137
+ $ childProductSku = $ bundleProductLink ->getSku ();
138
+ $ productRepository = ObjectManager::getInstance ()->get (ProductRepositoryInterface::class);
139
+ $ childProduct = $ productRepository ->get ($ childProductSku );
136
140
$ this ->assertEquals (1 , count ($ options ));
137
141
$ this ->assertResponseFields (
138
142
$ actualResponse ['items ' ][0 ],
@@ -154,12 +158,16 @@ private function assertBundleProductOptions($product, $actualResponse)
154
158
'is_default ' => (bool )$ bundleProductLink ->getIsDefault (),
155
159
'price ' => $ bundleProductLink ->getPrice (),
156
160
'price_type ' => self ::KEY_PRICE_TYPE_FIXED ,
157
- 'can_change_quantity ' => $ bundleProductLink ->getCanChangeQuantity ()
161
+ 'can_change_quantity ' => $ bundleProductLink ->getCanChangeQuantity (),
162
+ 'label ' => $ childProduct ->getName ()
158
163
]
159
164
);
160
165
$ this ->assertResponseFields (
161
166
$ actualResponse ['items ' ][0 ]['options ' ][0 ]['product ' ],
162
167
[
168
+ 'id ' => $ childProduct ->getId (),
169
+ 'name ' => $ childProduct ->getName (),
170
+ 'type_id ' => $ childProduct ->getTypeId (),
163
171
'sku ' => $ bundleProductLink ->getSku ()
164
172
]
165
173
);
0 commit comments