Skip to content

Commit 7618a9a

Browse files
author
Stanislav Idolov
authored
ENGCOM-1914: [Forwardport] Complete the fix for cache issue due to the currencies with no symbol #15903
2 parents d3a849c + 5d9e6ea commit 7618a9a

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

app/code/Magento/Catalog/Block/Category/Plugin/PriceBoxTags.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function afterGetCacheKey(PriceBox $subject, $result)
7171
'-',
7272
[
7373
$result,
74-
$this->priceCurrency->getCurrencySymbol(),
74+
$this->priceCurrency->getCurrency()->getCode(),
7575
$this->dateTime->scopeDate($this->scopeResolver->getScope()->getId())->format('Ymd'),
7676
$this->scopeResolver->getScope()->getId(),
7777
$this->customerSession->getCustomerGroupId(),

app/code/Magento/Catalog/Test/Unit/Block/Category/Plugin/PriceBoxTagsTest.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ class PriceBoxTagsTest extends \PHPUnit\Framework\TestCase
1616
*/
1717
private $priceCurrencyInterface;
1818

19+
/**
20+
* @var \Magento\Directory\Model\Currency | \PHPUnit_Framework_MockObject_MockObject
21+
*/
22+
private $currency;
23+
1924
/**
2025
* @var \Magento\Framework\Stdlib\DateTime\TimezoneInterface | \PHPUnit_Framework_MockObject_MockObject
2126
*/
@@ -46,6 +51,9 @@ protected function setUp()
4651
$this->priceCurrencyInterface = $this->getMockBuilder(
4752
\Magento\Framework\Pricing\PriceCurrencyInterface::class
4853
)->getMock();
54+
$this->currency = $this->getMockBuilder(\Magento\Directory\Model\Currency::class)
55+
->disableOriginalConstructor()
56+
->getMock();
4957
$this->timezoneInterface = $this->getMockBuilder(
5058
\Magento\Framework\Stdlib\DateTime\TimezoneInterface::class
5159
)->getMock();
@@ -82,7 +90,7 @@ protected function setUp()
8290
public function testAfterGetCacheKey()
8391
{
8492
$date = date('Ymd');
85-
$currencySymbol = '$';
93+
$currencyCode = 'USD';
8694
$result = 'result_string';
8795
$billingAddress = ['billing_address'];
8896
$shippingAddress = ['shipping_address'];
@@ -95,7 +103,7 @@ public function testAfterGetCacheKey()
95103
'-',
96104
[
97105
$result,
98-
$currencySymbol,
106+
$currencyCode,
99107
$date,
100108
$scopeId,
101109
$customerGroupId,
@@ -104,7 +112,8 @@ public function testAfterGetCacheKey()
104112
);
105113
$priceBox = $this->getMockBuilder(\Magento\Framework\Pricing\Render\PriceBox::class)
106114
->disableOriginalConstructor()->getMock();
107-
$this->priceCurrencyInterface->expects($this->once())->method('getCurrencySymbol')->willReturn($currencySymbol);
115+
$this->priceCurrencyInterface->expects($this->once())->method('getCurrency')->willReturn($this->currency);
116+
$this->currency->expects($this->once())->method('getCode')->willReturn($currencyCode);
108117
$scope = $this->getMockBuilder(\Magento\Framework\App\ScopeInterface::class)->getMock();
109118
$this->scopeResolverInterface->expects($this->any())->method('getScope')->willReturn($scope);
110119
$scope->expects($this->any())->method('getId')->willReturn($scopeId);

0 commit comments

Comments
 (0)