@@ -34,6 +34,34 @@ protected function setUp(): void
34
34
$ this ->getCustomerAuthenticationHeader = $ this ->objectManager ->get (GetCustomerAuthenticationHeader::class);
35
35
}
36
36
37
+ /**
38
+ * @magentoApiDataFixture Magento/Store/_files/second_website_with_two_stores.php
39
+ * @magentoApiDataFixture Magento/ConfigurableProduct/_files/product_configurable_in_multiple_websites.php
40
+ * @magentoApiDataFixture Magento/ConfigurableProduct/_files/product_configurable_in_multiple_websites_with_special_price.php
41
+ */
42
+ public function testMinimalPriceForConfigurableProductWithSpecialPrice () : void
43
+ {
44
+ $ headerMapFirstStore ['Store ' ] = 'default ' ;
45
+ $ headerMapSecondStore ['Store ' ] = 'fixture_second_store ' ;
46
+ $ query = $ this ->getProductsBySkuQuery ();
47
+ $ responseForFirstWebsite = $ this ->graphQlQuery ($ query , [], '' , $ headerMapFirstStore );
48
+ $ responseForSecondWebsite = $ this ->graphQlQuery ($ query , [], '' , $ headerMapSecondStore );
49
+
50
+ $ this ->assertNotEmpty ($ responseForFirstWebsite ['products ' ]);
51
+ $ priceRange = $ responseForFirstWebsite ['products ' ]['items ' ][0 ]['price_range ' ];
52
+ $ this ->assertEquals (10 , $ priceRange ['minimum_price ' ]['regular_price ' ]['value ' ]);
53
+ $ this ->assertEquals (10 , $ priceRange ['minimum_price ' ]['final_price ' ]['value ' ]);
54
+ $ this ->assertEquals (10 , $ priceRange ['maximum_price ' ]['regular_price ' ]['value ' ]);
55
+ $ this ->assertEquals (10 , $ priceRange ['maximum_price ' ]['final_price ' ]['value ' ]);
56
+
57
+ $ this ->assertNotEmpty ($ responseForSecondWebsite ['products ' ]);
58
+ $ priceRange = $ responseForSecondWebsite ['products ' ]['items ' ][0 ]['price_range ' ];
59
+ $ this ->assertEquals (20 , $ priceRange ['minimum_price ' ]['regular_price ' ]['value ' ]);
60
+ $ this ->assertEquals (4 , $ priceRange ['minimum_price ' ]['final_price ' ]['value ' ]);
61
+ $ this ->assertEquals (20 , $ priceRange ['maximum_price ' ]['regular_price ' ]['value ' ]);
62
+ $ this ->assertEquals (4 , $ priceRange ['maximum_price ' ]['final_price ' ]['value ' ]);
63
+ }
64
+
37
65
/**
38
66
* Test for checking if catalog rule price has been applied for all customer group
39
67
*
@@ -278,6 +306,63 @@ private function getProductSearchQuery(string $productSku): string
278
306
}
279
307
}
280
308
}
309
+ QUERY ;
310
+ }
311
+
312
+ /**
313
+ * Get a query which user filter for product sku and returns price_range
314
+ *
315
+ * @param string $productSku
316
+ * @return string
317
+ */
318
+ private function getProductsBySkuQuery () : string
319
+ {
320
+ return <<<QUERY
321
+ query getProductsBySku {
322
+ products(filter: { sku: { eq: "configurable" } }) {
323
+ items {
324
+ sku
325
+ name
326
+ price_range {
327
+ minimum_price {
328
+ regular_price {
329
+ value
330
+ currency
331
+ }
332
+ discount {
333
+ amount_off
334
+ percent_off
335
+ }
336
+ final_price {
337
+ value
338
+ currency
339
+ }
340
+ }
341
+ maximum_price {
342
+ regular_price {
343
+ value
344
+ currency
345
+ }
346
+ discount {
347
+ amount_off
348
+ percent_off
349
+ }
350
+ final_price {
351
+ value
352
+ currency
353
+ }
354
+ }
355
+ }
356
+ ... on ConfigurableProduct {
357
+ variants {
358
+ product {
359
+ sku
360
+ }
361
+ }
362
+ }
363
+ }
364
+ }
365
+ }
281
366
QUERY ;
282
367
}
283
368
}
0 commit comments