Skip to content

Commit 9d80fa3

Browse files
committed
#26121: special price & tier price are coming in base currency
Adjustments to api-functional test
1 parent 20cd3d0 commit 9d80fa3

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

dev/tests/api-functional/testsuite/Magento/GraphQl/CatalogCustomer/SpecialPriceTest.php

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@
1010
use Magento\TestFramework\TestCase\GraphQlAbstract;
1111
use Magento\Store\Api\StoreRepositoryInterface;
1212
use Magento\TestFramework\Helper\Bootstrap;
13+
use Magento\TestFramework\ObjectManager;
1314

1415
class SpecialPriceTest extends GraphQlAbstract
1516
{
1617
/**
17-
* @var \Magento\TestFramework\ObjectManager
18+
* @var ObjectManager
1819
*/
1920
private $objectManager;
2021

@@ -28,14 +29,11 @@ protected function setUp(): void
2829
*/
2930
public function testSpecialPrice()
3031
{
31-
/** @var string $productSku */
3232
$productSku = 'simple';
33-
/** @var string $query */
3433
$query = $this->getProductSearchQuery($productSku);
3534

3635
$response = $this->graphQlQuery($query);
3736

38-
/** @var float $specialPrice */
3937
$specialPrice = (float)$response['products']['items'][0]['special_price'];
4038
$this->assertEquals(5.99, $specialPrice);
4139
}
@@ -46,17 +44,11 @@ public function testSpecialPrice()
4644
*/
4745
public function testSpecialPriceWithCurrencyRate()
4846
{
49-
/** @var string $storeViewCode */
5047
$storeViewCode = 'fixture_second_store';
51-
/** @var StoreRepositoryInterface $storeRepository */
5248
$storeRepository = $this->objectManager->get(StoreRepositoryInterface::class);
53-
/** @var float $rate */
5449
$rate = $storeRepository->get($storeViewCode)->getCurrentCurrencyRate();
55-
/** @var string $productSku */
5650
$productSku = 'simple';
57-
/** @var string $query */
5851
$query = $this->getProductSearchQuery($productSku);
59-
/** @var array $headers */
6052
$headers = $this->getHeaderStore($storeViewCode);
6153

6254
$response = $this->graphQlQuery(
@@ -66,20 +58,21 @@ public function testSpecialPriceWithCurrencyRate()
6658
$headers
6759
);
6860

69-
/** @var float $specialPrice */
7061
$specialPrice = (float)$response['products']['items'][0]['special_price'];
7162
$this->assertEquals(round(5.99 * $rate, 2), $specialPrice);
7263
}
7364

7465
/**
66+
* Get a query which user filter for product sku and returns special_price
67+
*
7568
* @param string $productSku
7669
* @return string
7770
*/
7871
private function getProductSearchQuery(string $productSku): string
7972
{
8073
return <<<QUERY
8174
{
82-
products(search: "{$productSku}") {
75+
products(filter: {sku: {eq: "{$productSku}"}}) {
8376
items {
8477
special_price
8578
}
@@ -89,6 +82,8 @@ private function getProductSearchQuery(string $productSku): string
8982
}
9083

9184
/**
85+
* Get array that would be used in request header
86+
*
9287
* @param string $storeViewCode
9388
* @return array
9489
*/

0 commit comments

Comments
 (0)