@@ -75,12 +75,10 @@ public function testUpdateBundleProductWithOptions(): void
75
75
$ bundleOptions = $ this ->generateBundleOptionUid ((int ) $ optionId , (int ) $ selectionId , $ optionQty );
76
76
77
77
// Add product to wishlist
78
- $ this ->addProductToWishlist ();
79
-
80
- $ wishlist = $ this ->getBundleWishlist ();
81
- $ wishlistId = $ wishlist ['customer ' ]['wishlists ' ][0 ]['id ' ];
82
- $ wishlistItemId = $ wishlist ['customer ' ]['wishlists ' ][0 ]['items_v2 ' ][0 ]['id ' ];
83
- $ itemsCount = $ wishlist ['customer ' ]['wishlists ' ][0 ]['items_count ' ];
78
+ $ wishlist = $ this ->addProductToWishlist ();
79
+ $ wishlistId = $ wishlist ['addProductsToWishlist ' ]['wishlist ' ]['id ' ];
80
+ $ wishlistItemId = $ wishlist ['addProductsToWishlist ' ]['wishlist ' ]['items_v2 ' ][0 ]['id ' ];
81
+ $ itemsCount = $ wishlist ['addProductsToWishlist ' ]['wishlist ' ]['items_count ' ];
84
82
85
83
$ query = $ this ->getBundleQuery ((int )$ wishlistItemId , $ qty , $ bundleOptions , (int )$ wishlistId );
86
84
$ response = $ this ->graphQlMutation ($ query , [], '' , $ this ->getHeaderMap ());
@@ -112,50 +110,6 @@ private function getHeaderMap(string $username = 'customer@example.com', string
112
110
return ['Authorization ' => 'Bearer ' . $ customerToken ];
113
111
}
114
112
115
- /**
116
- * Get Bundle wishlist result
117
- *
118
- * @param string $username
119
- * @return array
120
- *
121
- * @throws Exception
122
- */
123
- private function getBundleWishlist (string $ username = 'customer@example.com ' ): array
124
- {
125
- return $ this ->graphQlQuery ($ this ->getCustomerBundleWishlistQuery (), [], '' , $ this ->getHeaderMap ($ username ));
126
- }
127
-
128
- private function getCustomerBundleWishlistQuery (): string
129
- {
130
- return <<<QUERY
131
- query {
132
- customer {
133
- wishlists {
134
- id
135
- items_count
136
- items_v2 {
137
- id
138
- quantity
139
- ... on BundleWishlistItem{
140
- bundle_options{
141
- id
142
- label
143
- type
144
- values {
145
- id
146
- label
147
- quantity
148
- price
149
- }
150
- }
151
- }
152
- }
153
- }
154
- }
155
- }
156
- QUERY ;
157
- }
158
-
159
113
/**
160
114
* Returns GraphQl mutation string
161
115
*
@@ -236,8 +190,9 @@ private function generateBundleOptionUid(int $optionId, int $selectionId, int $q
236
190
* @magentoApiDataFixture Magento/Bundle/_files/product_1.php
237
191
*
238
192
* @throws Exception
193
+ * return array
239
194
*/
240
- private function addProductToWishlist (): void
195
+ private function addProductToWishlist (): array
241
196
{
242
197
$ sku = 'bundle-product ' ;
243
198
$ product = $ this ->productRepository ->get ($ sku );
@@ -256,7 +211,7 @@ private function addProductToWishlist(): void
256
211
$ bundleOptions = $ this ->generateBundleOptionUid ((int ) $ optionId , (int ) $ selectionId , $ optionQty );
257
212
258
213
$ query = $ this ->addQuery ($ sku , $ qty , $ bundleOptions );
259
- $ this ->graphQlMutation ($ query , [], '' , $ this ->getHeaderMap ());
214
+ return $ this ->graphQlMutation ($ query , [], '' , $ this ->getHeaderMap ());
260
215
}
261
216
262
217
/**
@@ -321,6 +276,5 @@ private function addQuery(
321
276
}
322
277
MUTATION ;
323
278
}
324
-
325
279
}
326
280
0 commit comments