Skip to content

Commit eef6458

Browse files
committed
ACP2E-3276: Order reports showing the wrong currency symbol
1 parent 1508250 commit eef6458

File tree

1 file changed

+24
-3
lines changed
  • app/code/Magento/Reports/Test/Unit/Block/Adminhtml/Grid/Column/Renderer

1 file changed

+24
-3
lines changed

app/code/Magento/Reports/Test/Unit/Block/Adminhtml/Grid/Column/Renderer/CurrencyTest.php

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ protected function setUp(): void
179179
* @param int $adminWebsiteId
180180
* @param string $adminCurrencyCode
181181
* @param string $storeCurrencyCode
182+
* @param string $displayCurrencyCode
182183
* @param string $adminOrderAmount
183184
* @param string $convertedAmount
184185
* @param bool $needToGetRateFromModel
@@ -195,6 +196,7 @@ public function testRender(
195196
int $adminWebsiteId,
196197
string $adminCurrencyCode,
197198
string $storeCurrencyCode,
199+
string $displayCurrencyCode,
198200
string $adminOrderAmount,
199201
string $convertedAmount,
200202
bool $needToGetRateFromModel
@@ -242,6 +244,10 @@ public function testRender(
242244
->expects($this->any())
243245
->method('getDefaultCurrency')
244246
->willReturn($storeCurrencyCode);
247+
$this->currencyLocatorMock
248+
->expects($this->any())
249+
->method('getDisplayCurrency')
250+
->willReturn($displayCurrencyCode);
245251
$currLocaleMock = $this->createMock(CurrencyData::class);
246252
$currLocaleMock
247253
->expects($this->any())
@@ -250,9 +256,9 @@ public function testRender(
250256
$this->localeCurrencyMock
251257
->expects($this->any())
252258
->method('getCurrency')
253-
->with($storeCurrencyCode)
259+
->with($displayCurrencyCode)
254260
->willReturn($currLocaleMock);
255-
$this->gridColumnMock->method('getCurrency')->willReturn('USD');
261+
$this->gridColumnMock->method('getCurrency')->willReturn($displayCurrencyCode);
256262
$this->gridColumnMock->method('getRateField')->willReturn('test_rate_field');
257263

258264
if ($needToGetRateFromModel) {
@@ -281,8 +287,9 @@ public function getCurrencyDataProvider(): array
281287
'adminWebsiteId' => 1,
282288
'adminCurrencyCode' => 'EUR',
283289
'storeCurrencyCode' => 'EUR',
290+
'displayCurrencyCode' => 'EUR',
284291
'adminOrderAmount' => '105.00',
285-
'convertedAmount' => '105.00',
292+
'convertedAmount' => '105.00',
286293
'needToGetRateFromModel' => false
287294
],
288295
'rate conversion with different admin and storefront rate' => [
@@ -292,6 +299,7 @@ public function getCurrencyDataProvider(): array
292299
'adminWebsiteId' => 1,
293300
'adminCurrencyCode' => 'USD',
294301
'storeCurrencyCode' => 'EUR',
302+
'displayCurrencyCode' => 'EUR',
295303
'adminOrderAmount' => '105.00',
296304
'convertedAmount' => '148.575',
297305
'needToGetRateFromModel' => true
@@ -303,10 +311,23 @@ public function getCurrencyDataProvider(): array
303311
'adminWebsiteId' => 1,
304312
'adminCurrencyCode' => 'USD',
305313
'storeCurrencyCode' => 'THB',
314+
'displayCurrencyCode' => 'THB',
306315
'adminOrderAmount' => '100.00',
307316
'convertedAmount' => '100.00',
308317
'needToGetRateFromModel' => true
309318
],
319+
'rate conversation with different rate for different display currencies' => [
320+
'rate' => 1.6150,
321+
'columnIndex' => 'total_income_amount',
322+
'catalogPriceScope' => 1,
323+
'adminWebsiteId' => 1,
324+
'adminCurrencyCode' => 'USD',
325+
'storeCurrencyCode' => 'USD',
326+
'displayCurrencyCode' => 'EUR',
327+
'adminOrderAmount' => '$100.00',
328+
'convertedAmount' => '€161.50',
329+
'needToGetRateFromModel' => false
330+
],
310331
];
311332
}
312333

0 commit comments

Comments
 (0)