Skip to content

Commit eec9c29

Browse files
committed
Merge branch 'ACP2E-3312' of https://github.com/adobe-commerce-tier-4/magento2ce into PR-14-10-2024
2 parents d7f20dd + 3a8124e commit eec9c29

File tree

3 files changed

+28
-30
lines changed

3 files changed

+28
-30
lines changed

app/code/Magento/CatalogCustomerGraphQl/Model/Resolver/PriceTiers.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2019 Adobe
4+
* All Rights Reserved.
55
*/
66
declare(strict_types=1);
77

@@ -182,7 +182,7 @@ private function formatTierPrices(float $productPrice, string $currencyCode, $ti
182182
"discount" => $discount,
183183
"quantity" => $tierPrice->getQty(),
184184
"final_price" => [
185-
"value" => $tierPrice->getValue() * $tierPrice->getQty(),
185+
"value" => $tierPrice->getValue(),
186186
"currency" => $currencyCode
187187
]
188188
];

dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductPriceTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2019 Adobe
4+
* All Rights Reserved.
55
*/
66
declare(strict_types=1);
77

@@ -373,14 +373,14 @@ public static function priceDataProvider() : array
373373
"simple1" => [
374374
0 => [
375375
'discount' =>['amount_off' => 1, 'percent_off' => 10],
376-
'final_price' =>['value'=> 9 * 2],
376+
'final_price' =>['value'=> 9],
377377
'quantity' => 2
378378
]
379379
],
380380
"simple2" => [
381381
0 => [
382382
'discount' =>['amount_off' => 2, 'percent_off' => 10],
383-
'final_price' =>['value'=> 18 * 2],
383+
'final_price' =>['value'=> 18],
384384
'quantity' => 2
385385
]
386386
]
@@ -419,14 +419,14 @@ public static function priceDataProvider() : array
419419
"simple1" => [
420420
0 => [
421421
'discount' =>['amount_off' => 1, 'percent_off' => 10],
422-
'final_price' =>['value'=> 9 * 2 ],
422+
'final_price' =>['value'=> 9],
423423
'quantity' => 2
424424
]
425425
],
426426
"simple2" => [
427427
0 => [
428428
'discount' =>['amount_off' => 2, 'percent_off' => 10],
429-
'final_price' =>['value'=> 18 * 2],
429+
'final_price' =>['value'=> 18],
430430
'quantity' => 2
431431
]
432432
]
@@ -606,7 +606,7 @@ public function testBundledProductWithSpecialPriceAndTierPrice()
606606
'amount_off' => 1,
607607
'percent_off' => 10
608608
],
609-
'final_price' =>['value'=> 9 * 2],
609+
'final_price' =>['value'=> 9],
610610
'quantity' => 2
611611
]
612612
]
@@ -809,7 +809,7 @@ public function testConfigurableProductWithVariantsHavingSpecialAndTierPrices()
809809
2
810810
)
811811
],
812-
'final_price' =>['value'=> $tierPriceData[0]['value'] * 2],
812+
'final_price' =>['value'=> $tierPriceData[0]['value']],
813813
'quantity' => 2
814814
]
815815
]
@@ -887,7 +887,7 @@ public function testDownloadableProductWithSpecialPriceAndTierPrices()
887887
'amount_off' => 3,
888888
'percent_off' => 30
889889
],
890-
'final_price' =>['value'=> 7 * 2],
890+
'final_price' =>['value'=> 7],
891891
'quantity' => 2
892892
]
893893
]

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

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2020 Adobe
4+
* All Rights Reserved.
55
*/
66
declare(strict_types=1);
77

@@ -43,9 +43,9 @@ public function testAllGroups()
4343

4444
$itemTiers = $response['products']['items'][0]['price_tiers'];
4545
$this->assertCount(5, $itemTiers);
46-
$this->assertEquals(round(8 * 2, 2), $this->getValueForQuantity(2, $itemTiers));
47-
$this->assertEquals(round(5 * 3, 2), $this->getValueForQuantity(3, $itemTiers));
48-
$this->assertEquals(round(6 * 3.2, 2), $this->getValueForQuantity(3.2, $itemTiers));
46+
$this->assertEquals(8, $this->getValueForQuantity(2, $itemTiers));
47+
$this->assertEquals(5, $this->getValueForQuantity(3, $itemTiers));
48+
$this->assertEquals(6, $this->getValueForQuantity(3.2, $itemTiers));
4949
}
5050

5151
/**
@@ -65,11 +65,11 @@ public function testLoggedInCustomer()
6565

6666
$itemTiers = $response['products']['items'][0]['price_tiers'];
6767
$this->assertCount(5, $itemTiers);
68-
$this->assertEquals(round(9.25 * 2, 2), $this->getValueForQuantity(2, $itemTiers));
69-
$this->assertEquals(round(8.25 * 3, 2), $this->getValueForQuantity(3, $itemTiers));
70-
$this->assertEquals(round(7.25 * 5, 2), $this->getValueForQuantity(5, $itemTiers));
71-
$this->assertEquals(round(9.00 * 7, 2), $this->getValueForQuantity(7, $itemTiers));
72-
$this->assertEquals(round(7.25 * 8, 2), $this->getValueForQuantity(8, $itemTiers));
68+
$this->assertEquals(9.25, $this->getValueForQuantity(2, $itemTiers));
69+
$this->assertEquals(8.25, $this->getValueForQuantity(3, $itemTiers));
70+
$this->assertEquals(7.25, $this->getValueForQuantity(5, $itemTiers));
71+
$this->assertEquals(9.00, $this->getValueForQuantity(7, $itemTiers));
72+
$this->assertEquals(7.25, $this->getValueForQuantity(8, $itemTiers));
7373
}
7474

7575
/**
@@ -98,9 +98,9 @@ public function testSecondStoreViewWithCurrencyRate()
9898

9999
$itemTiers = $response['products']['items'][0]['price_tiers'];
100100
$this->assertCount(5, $itemTiers);
101-
$this->assertEquals(round((9.25 * 2) * $rate, 2), $this->getValueForQuantity(2, $itemTiers));
102-
$this->assertEquals(round((8.25 * 3) * $rate, 2), $this->getValueForQuantity(3, $itemTiers));
103-
$this->assertEquals(round((7.25 * 5) * $rate, 2), $this->getValueForQuantity(5, $itemTiers));
101+
$this->assertEquals(round(9.25 * $rate, 2), $this->getValueForQuantity(2, $itemTiers));
102+
$this->assertEquals(round(8.25 * $rate, 2), $this->getValueForQuantity(3, $itemTiers));
103+
$this->assertEquals(round(7.25 * $rate, 2), $this->getValueForQuantity(5, $itemTiers));
104104
}
105105

106106
/**
@@ -113,8 +113,8 @@ public function testGetLowestPriceForGuest()
113113
$response = $this->graphQlQuery($query);
114114
$itemTiers = $response['products']['items'][0]['price_tiers'];
115115
$this->assertCount(2, $itemTiers);
116-
$this->assertEquals(round((8.25 * 7), 2), $this->getValueForQuantity(7, $itemTiers));
117-
$this->assertEquals(round((7.25 * 8), 2), $this->getValueForQuantity(8, $itemTiers));
116+
$this->assertEquals(8.25, $this->getValueForQuantity(7, $itemTiers));
117+
$this->assertEquals(7.25, $this->getValueForQuantity(8, $itemTiers));
118118
}
119119

120120
/**
@@ -147,9 +147,7 @@ public function testProductTierPricesAreCorrectlyReturned()
147147
if (in_array($item['sku'], $productsWithTierPrices)) {
148148
$this->assertCount(1, $response['products']['items'][$key]['price_tiers']);
149149
} else {
150-
if (empty($response['products']['items'][$key]['price_tiers'])) {
151-
$this->assertCount(0, $response['products']['items'][$key]['price_tiers']);
152-
}
150+
$this->assertCount(0, $response['products']['items'][$key]['price_tiers']);
153151
}
154152
}
155153
}

0 commit comments

Comments
 (0)