@@ -179,6 +179,7 @@ protected function setUp(): void
179
179
* @param int $adminWebsiteId
180
180
* @param string $adminCurrencyCode
181
181
* @param string $storeCurrencyCode
182
+ * @param string $displayCurrencyCode
182
183
* @param string $adminOrderAmount
183
184
* @param string $convertedAmount
184
185
* @param bool $needToGetRateFromModel
@@ -195,6 +196,7 @@ public function testRender(
195
196
int $ adminWebsiteId ,
196
197
string $ adminCurrencyCode ,
197
198
string $ storeCurrencyCode ,
199
+ string $ displayCurrencyCode ,
198
200
string $ adminOrderAmount ,
199
201
string $ convertedAmount ,
200
202
bool $ needToGetRateFromModel
@@ -242,6 +244,10 @@ public function testRender(
242
244
->expects ($ this ->any ())
243
245
->method ('getDefaultCurrency ' )
244
246
->willReturn ($ storeCurrencyCode );
247
+ $ this ->currencyLocatorMock
248
+ ->expects ($ this ->any ())
249
+ ->method ('getDisplayCurrency ' )
250
+ ->willReturn ($ displayCurrencyCode );
245
251
$ currLocaleMock = $ this ->createMock (CurrencyData::class);
246
252
$ currLocaleMock
247
253
->expects ($ this ->any ())
@@ -250,9 +256,9 @@ public function testRender(
250
256
$ this ->localeCurrencyMock
251
257
->expects ($ this ->any ())
252
258
->method ('getCurrency ' )
253
- ->with ($ storeCurrencyCode )
259
+ ->with ($ displayCurrencyCode )
254
260
->willReturn ($ currLocaleMock );
255
- $ this ->gridColumnMock ->method ('getCurrency ' )->willReturn (' USD ' );
261
+ $ this ->gridColumnMock ->method ('getCurrency ' )->willReturn ($ displayCurrencyCode );
256
262
$ this ->gridColumnMock ->method ('getRateField ' )->willReturn ('test_rate_field ' );
257
263
258
264
if ($ needToGetRateFromModel ) {
@@ -281,8 +287,9 @@ public function getCurrencyDataProvider(): array
281
287
'adminWebsiteId ' => 1 ,
282
288
'adminCurrencyCode ' => 'EUR ' ,
283
289
'storeCurrencyCode ' => 'EUR ' ,
290
+ 'displayCurrencyCode ' => 'EUR ' ,
284
291
'adminOrderAmount ' => '105.00 ' ,
285
- 'convertedAmount ' => '105.00 ' ,
292
+ 'convertedAmount ' => '€ 105.00 ' ,
286
293
'needToGetRateFromModel ' => false
287
294
],
288
295
'rate conversion with different admin and storefront rate ' => [
@@ -292,6 +299,7 @@ public function getCurrencyDataProvider(): array
292
299
'adminWebsiteId ' => 1 ,
293
300
'adminCurrencyCode ' => 'USD ' ,
294
301
'storeCurrencyCode ' => 'EUR ' ,
302
+ 'displayCurrencyCode ' => 'EUR ' ,
295
303
'adminOrderAmount ' => '105.00 ' ,
296
304
'convertedAmount ' => '148.575 ' ,
297
305
'needToGetRateFromModel ' => true
@@ -303,10 +311,23 @@ public function getCurrencyDataProvider(): array
303
311
'adminWebsiteId ' => 1 ,
304
312
'adminCurrencyCode ' => 'USD ' ,
305
313
'storeCurrencyCode ' => 'THB ' ,
314
+ 'displayCurrencyCode ' => 'THB ' ,
306
315
'adminOrderAmount ' => '100.00 ' ,
307
316
'convertedAmount ' => '100.00 ' ,
308
317
'needToGetRateFromModel ' => true
309
318
],
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
+ ],
310
331
];
311
332
}
312
333
0 commit comments