Skip to content

Commit 4fce8c0

Browse files
committed
ACP2E-4110: [Cloud] Bundle product price issue
1 parent c8ff030 commit 4fce8c0

File tree

4 files changed

+107
-10
lines changed

4 files changed

+107
-10
lines changed

app/code/Magento/Bundle/Test/Unit/Pricing/Price/BundleRegularPriceTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public function testGetAmount()
9898
->willReturn($expectedResult);
9999

100100
$this->priceCurrencyMock->expects($this->once())
101-
->method('convertAndRound')
101+
->method('convert')
102102
->willReturnArgument(0);
103103

104104
$result = $this->regularPrice->getAmount();
@@ -123,7 +123,7 @@ public function testGetMaximalPrice()
123123
->willReturn($expectedResult);
124124

125125
$this->priceCurrencyMock->expects($this->once())
126-
->method('convertAndRound')
126+
->method('convert')
127127
->willReturnArgument(0);
128128

129129
$result = $this->regularPrice->getMaximalPrice();
@@ -165,7 +165,7 @@ public function testGetMaximalPriceForFixedPriceBundleWithOption()
165165
->willReturn($expectedPrice);
166166

167167
$this->priceCurrencyMock->expects($this->once())
168-
->method('convertAndRound')
168+
->method('convert')
169169
->willReturnArgument(0);
170170

171171
$result = $this->regularPrice->getMaximalPrice();
@@ -185,7 +185,7 @@ public function testGetMinimalPrice()
185185
->willReturn($expectedResult);
186186

187187
$this->priceCurrencyMock->expects($this->once())
188-
->method('convertAndRound')
188+
->method('convert')
189189
->willReturnArgument(0);
190190

191191
$this->bundleCalculatorMock->expects($this->once())
@@ -226,7 +226,7 @@ public function testGetMinimalPriceForFixedPricedBundleWithOptions()
226226
->willReturn($minOptionPrice);
227227

228228
$this->priceCurrencyMock->expects($this->once())
229-
->method('convertAndRound')
229+
->method('convert')
230230
->willReturnArgument(0);
231231

232232
$this->bundleCalculatorMock->expects($this->once())

app/code/Magento/Catalog/Pricing/Price/RegularPrice.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010
use Magento\Framework\Pricing\Price\BasePriceProviderInterface;
1111

1212
/**
13-
* Class RegularPrice
13+
* Regular Price model
1414
*/
1515
class RegularPrice extends AbstractPrice implements BasePriceProviderInterface
1616
{
1717
/**
1818
* Price type
1919
*/
20-
const PRICE_CODE = 'regular_price';
20+
public const PRICE_CODE = 'regular_price';
2121

2222
/**
2323
* Get price value
@@ -28,7 +28,7 @@ public function getValue()
2828
{
2929
if ($this->value === null) {
3030
$price = $this->product->getPrice();
31-
$priceInCurrentCurrency = $this->priceCurrency->convertAndRound($price);
31+
$priceInCurrentCurrency = $this->priceCurrency->convert($price);
3232
$this->value = $priceInCurrentCurrency ? (float)$priceInCurrentCurrency : 0;
3333
}
3434
return $this->value;

app/code/Magento/Catalog/Test/Unit/Pricing/Price/RegularPriceTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public function testGetValue($price)
8080
->method('getPrice')
8181
->willReturn($price);
8282
$this->priceCurrencyMock->expects($this->any())
83-
->method('convertAndRound')
83+
->method('convert')
8484
->with($price)
8585
->willReturn($convertedPrice);
8686
$this->assertEquals($convertedPrice, $this->regularPrice->getValue());
@@ -114,7 +114,7 @@ public function testGetAmount()
114114
->method('getPrice')
115115
->willReturn($priceValue);
116116
$this->priceCurrencyMock->expects($this->any())
117-
->method('convertAndRound')
117+
->method('convert')
118118
->with($priceValue)
119119
->willReturn($convertedPrice);
120120
$this->calculatorMock->expects($this->once())
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright 2024 Adobe
5+
* All Rights Reserved.
6+
*/
7+
-->
8+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="StorefrontCheckBundlePriceInOtherCurrencyWithSpecialPriceTest">
12+
<annotations>
13+
<stories value="Bundle"/>
14+
<title value="Bundle price on Storefront in other currency with special price"/>
15+
<description value="Checks bundle price in other currency on Storefront when special price is applied"/>
16+
<severity value="MAJOR"/>
17+
<testCaseId value="AC-15624"/>
18+
<useCaseId value="ACP2E-4110"/>
19+
</annotations>
20+
<before>
21+
<!-- Set currency -->
22+
<magentoCLI command="config:set currency/options/allow EUR,GBP,USD" stepKey="setCurrencyAllow"/>
23+
<magentoCLI command="config:set currency/options/default GBP" stepKey="setCurrencyDisplay"/>
24+
<actionGroup ref="AdminLoginActionGroup" stepKey="LoginAsAdmin"/>
25+
<actionGroup ref="AdminOpenCurrencyRatesPageActionGroup" stepKey="gotToCurrencyRatesPage"/>
26+
<actionGroup ref="AdminSetCurrencyRatesActionGroup" stepKey="setCurrencyRate">
27+
<argument name="firstCurrency" value="USD"/>
28+
<argument name="secondCurrency" value="GBP"/>
29+
<argument name="rate" value="0.75"/>
30+
</actionGroup>
31+
<!-- Create Category -->
32+
<createData entity="SimpleSubCategory" stepKey="createSubCategory"/>
33+
<!-- Create bundle Product -->
34+
<createData entity="SimpleProduct2" stepKey="simpleProduct1">
35+
<field key="price">40.25</field>
36+
</createData>
37+
<createData entity="ApiBundleProductPriceViewRange" stepKey="createBundleProduct">
38+
<requiredEntity createDataKey="createSubCategory"/>
39+
</createData>
40+
<createData entity="DropDownBundleOption" stepKey="createBundleOption1_1">
41+
<requiredEntity createDataKey="createBundleProduct"/>
42+
<field key="required">True</field>
43+
</createData>
44+
<createData entity="ApiBundleLink" stepKey="linkOptionToProduct">
45+
<requiredEntity createDataKey="createBundleProduct"/>
46+
<requiredEntity createDataKey="createBundleOption1_1"/>
47+
<requiredEntity createDataKey="simpleProduct1"/>
48+
</createData>
49+
<actionGroup ref="NavigateToCreatedProductEditPageActionGroup" stepKey="goToBundleProduct">
50+
<argument name="product" value="$$createBundleProduct$$"/>
51+
</actionGroup>
52+
<grabTextFrom selector="{{AdminProductFormBundleSection.currentBundleOption}}" stepKey="grabBundleOption"/>
53+
<assertNotEmpty stepKey="assertBundleOptionNotEmpty">
54+
<actualResult type="const">$grabBundleOption</actualResult>
55+
</assertNotEmpty>
56+
<actionGroup ref="AddSpecialPriceToProductActionGroup" stepKey="addSpecialPriceToProduct">
57+
<argument name="price" value="97.5"/>
58+
</actionGroup>
59+
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductForm"/>
60+
<actionGroup ref="AdminClearFiltersActionGroup" stepKey="clearProductGridFilters"/>
61+
<!-- Reindex and clear cache -->
62+
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindexConfig">
63+
<argument name="indices" value=""/>
64+
</actionGroup>
65+
<actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanFullPageCache">
66+
<argument name="tags" value="config full_page"/>
67+
</actionGroup>
68+
</before>
69+
70+
<after>
71+
<!-- Delete products and category -->
72+
<deleteData createDataKey="createSubCategory" stepKey="deleteCategory1"/>
73+
<deleteData createDataKey="simpleProduct1" stepKey="deleteProduct1"/>
74+
<deleteData createDataKey="createBundleProduct" stepKey="deleteBundleProduct"/>
75+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
76+
<!-- Revert currency settings -->
77+
<magentoCLI command="config:set currency/options/default USD" stepKey="unsetCurrencyDisplay"/>
78+
<magentoCLI command="config:set currency/options/allow EUR,USD" stepKey="unsetCurrencyAllow"/>
79+
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindexConfigAfterReverting">
80+
<argument name="indices" value=""/>
81+
</actionGroup>
82+
<actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanFullPageCacheAfterReverting">
83+
<argument name="tags" value="config full_page"/>
84+
</actionGroup>
85+
</after>
86+
87+
<!-- Open Bundle product page -->
88+
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openStorefrontProductPage">
89+
<argument name="productUrl" value="$$createBundleProduct.custom_attributes[url_key]$$"/>
90+
</actionGroup>
91+
<waitForPageLoad stepKey="waitForStorefrontPage"/>
92+
93+
<!-- Assert Bundle Product Price -->
94+
<see userInput="£29.43" selector="{{StorefrontProductInfoMainSection.fixedFinalPrice}}" stepKey="seeBundlePrice"/>
95+
96+
</test>
97+
</tests>

0 commit comments

Comments
 (0)