Skip to content

Commit 6481697

Browse files
committed
ACP2E-1541: There is a problem with the magento report order screen
1 parent 732ef67 commit 6481697

File tree

1 file changed

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

1 file changed

+29
-4
lines changed

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

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
use Magento\Store\Api\Data\StoreInterface;
2424
use Magento\Store\Api\Data\WebsiteInterface;
2525
use Magento\Store\Model\StoreManagerInterface;
26+
use Magento\Store\Model\Store;
27+
use Magento\Store\Model\ScopeInterface;
2628
use PHPUnit\Framework\MockObject\MockObject;
2729
use PHPUnit\Framework\TestCase;
2830

@@ -181,6 +183,7 @@ protected function setUp(): void
181183
* @param string $storeCurrencyCode
182184
* @param string $adminOrderAmount
183185
* @param string $convertedAmount
186+
* @param bool $needToGetRateFromModel
184187
* @throws LocalizedException
185188
* @throws NoSuchEntityException
186189
* @throws CurrencyException
@@ -195,7 +198,8 @@ public function testRender(
195198
string $adminCurrencyCode,
196199
string $storeCurrencyCode,
197200
string $adminOrderAmount,
198-
string $convertedAmount
201+
string $convertedAmount,
202+
bool $needToGetRateFromModel
199203
): void {
200204
$this->row = new DataObject(
201205
[
@@ -252,6 +256,14 @@ public function testRender(
252256
->willReturn($currLocaleMock);
253257
$this->gridColumnMock->method('getCurrency')->willReturn('USD');
254258
$this->gridColumnMock->method('getRateField')->willReturn('test_rate_field');
259+
260+
if ($needToGetRateFromModel) {
261+
$this->currencyMock->expects($this->once())
262+
->method('getRate')
263+
->with($adminCurrencyCode)
264+
->willReturn($rate);
265+
}
266+
255267
$actualAmount = $this->model->render($this->row);
256268
$this->assertEquals($convertedAmount, $actualAmount);
257269
}
@@ -272,7 +284,8 @@ public function getCurrencyDataProvider(): array
272284
'adminCurrencyCode' => 'EUR',
273285
'storeCurrencyCode' => 'EUR',
274286
'adminOrderAmount' => '105.00',
275-
'convertedAmount' => '105.00'
287+
'convertedAmount' => '105.00',
288+
'needToGetRateFromModel' => false
276289
],
277290
'rate conversion with different admin and storefront rate' => [
278291
'rate' => 1.4150,
@@ -282,8 +295,20 @@ public function getCurrencyDataProvider(): array
282295
'adminCurrencyCode' => 'USD',
283296
'storeCurrencyCode' => 'EUR',
284297
'adminOrderAmount' => '105.00',
285-
'convertedAmount' => '148.575'
286-
]
298+
'convertedAmount' => '148.575',
299+
'needToGetRateFromModel' => true
300+
],
301+
'rate conversation with same rate for different currencies' => [
302+
'rate' => 1.00,
303+
'columnIndex' => 'total_income_amount',
304+
'catalogPriceScope' => 1,
305+
'adminWebsiteId' => 1,
306+
'adminCurrencyCode' => 'USD',
307+
'storeCurrencyCode' => 'THB',
308+
'adminOrderAmount' => '100.00',
309+
'convertedAmount' => '100.00',
310+
'needToGetRateFromModel' => true
311+
],
287312
];
288313
}
289314

0 commit comments

Comments
 (0)