|
11 | 11 | use Magento\TestFramework\Helper\Bootstrap;
|
12 | 12 | use Magento\TestFramework\ObjectManager;
|
13 | 13 | use Magento\TestFramework\TestCase\GraphQlAbstract;
|
| 14 | +use Magento\Tests\NamingConvention\true\string; |
14 | 15 |
|
15 | 16 | /**
|
16 | 17 | * Test class to verify catalog price rule is applied for
|
@@ -278,6 +279,83 @@ private function getProductSearchQuery(string $productSku): string
|
278 | 279 | }
|
279 | 280 | }
|
280 | 281 | }
|
| 282 | +QUERY; |
| 283 | + } |
| 284 | + |
| 285 | + /** |
| 286 | + * @magentoApiDataFixture Magento/Catalog/_files/product_configurable_in_multiple_websites_with_special_price.php |
| 287 | + */ |
| 288 | + public function testMinimalPriceForConfigurableProductWithSpecialPrice() : void |
| 289 | + { |
| 290 | + $query = $this->getProductsBySkuQuery(); |
| 291 | + $response = $this->graphQlQuery( |
| 292 | + $query, |
| 293 | + [], |
| 294 | + '', |
| 295 | + $this->getCustomerAuthenticationHeader->execute('customer@example.com', 'password') |
| 296 | + ); |
| 297 | + $this->assertNotEmpty($response['products']); |
| 298 | + $priceRange = $response['products']['items'][0]['price_range']; |
| 299 | + $this->assertEquals(10, $priceRange['minimum_price']['regular_price']['value']); |
| 300 | + $this->assertEquals(10, $priceRange['minimum_price']['final_price']['value']); |
| 301 | + $this->assertEquals(10, $priceRange['maximum_price']['regular_price']['value']); |
| 302 | + $this->assertEquals(10, $priceRange['maximum_price']['final_price']['value']); |
| 303 | + } |
| 304 | + |
| 305 | + /** |
| 306 | + * Get a query which user filter for product sku and returns price_range |
| 307 | + * |
| 308 | + * @param string $productSku |
| 309 | + * @return string |
| 310 | + */ |
| 311 | + private function getProductsBySkuQuery() : string |
| 312 | + { |
| 313 | + return <<<QUERY |
| 314 | +query getProductsBySku { |
| 315 | + products(filter: { sku: { eq: "configurable" } }) { |
| 316 | + items { |
| 317 | + sku |
| 318 | + name |
| 319 | + price_range { |
| 320 | + minimum_price { |
| 321 | + regular_price { |
| 322 | + value |
| 323 | + currency |
| 324 | + } |
| 325 | + discount { |
| 326 | + amount_off |
| 327 | + percent_off |
| 328 | + } |
| 329 | + final_price { |
| 330 | + value |
| 331 | + currency |
| 332 | + } |
| 333 | + } |
| 334 | + maximum_price { |
| 335 | + regular_price { |
| 336 | + value |
| 337 | + currency |
| 338 | + } |
| 339 | + discount { |
| 340 | + amount_off |
| 341 | + percent_off |
| 342 | + } |
| 343 | + final_price { |
| 344 | + value |
| 345 | + currency |
| 346 | + } |
| 347 | + } |
| 348 | + } |
| 349 | + ... on ConfigurableProduct { |
| 350 | + variants { |
| 351 | + product { |
| 352 | + sku |
| 353 | + } |
| 354 | + } |
| 355 | + } |
| 356 | + } |
| 357 | + } |
| 358 | +} |
281 | 359 | QUERY;
|
282 | 360 | }
|
283 | 361 | }
|
0 commit comments