Skip to content

Commit 943f09a

Browse files
author
Stanislav Idolov
authored
ENGCOM-826: Fix cache issue for currencies with no symbol #13894
2 parents 3f27b2f + e0cd24e commit 943f09a

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

app/code/Magento/ConfigurableProduct/Block/Product/View/Type/Configurable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public function __construct(
136136
public function getCacheKeyInfo()
137137
{
138138
$parentData = parent::getCacheKeyInfo();
139-
$parentData[] = $this->priceCurrency->getCurrencySymbol();
139+
$parentData[] = $this->priceCurrency->getCurrency()->getCode();
140140
$parentData[] = $this->customerSession->getCustomerGroupId();
141141
return $parentData;
142142
}

app/code/Magento/ConfigurableProduct/Test/Unit/Block/Product/View/Type/ConfigurableTest.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ class ConfigurableTest extends \PHPUnit\Framework\TestCase
4848
*/
4949
private $priceCurrency;
5050

51+
/**
52+
* @var \Magento\Directory\Model\Currency|\PHPUnit_Framework_MockObject_MockObject
53+
*/
54+
private $currency;
55+
5156
/**
5257
* @var \Magento\ConfigurableProduct\Model\ConfigurableAttributeData|\PHPUnit_Framework_MockObject_MockObject
5358
*/
@@ -127,6 +132,9 @@ protected function setUp()
127132
$this->context->expects($this->once())
128133
->method('getResolver')
129134
->willReturn($fileResolverMock);
135+
$this->currency = $this->getMockBuilder(\Magento\Directory\Model\Currency::class)
136+
->disableOriginalConstructor()
137+
->getMock();
130138
$this->configurableAttributeData = $this->getMockBuilder(
131139
\Magento\ConfigurableProduct\Model\ConfigurableAttributeData::class
132140
)
@@ -202,10 +210,10 @@ public function cacheKeyProvider() : array
202210
2 => null,
203211
'base_url' => null,
204212
'template' => null,
205-
3 => '$',
213+
3 => 'USD',
206214
4 => null,
207215
],
208-
'$',
216+
'USD',
209217
null,
210218
]
211219
];
@@ -233,7 +241,10 @@ public function testGetCacheKeyInfo(array $expected, string $priceCurrency = nul
233241
->method('getStore')
234242
->willReturn($storeMock);
235243
$this->priceCurrency->expects($this->once())
236-
->method('getCurrencySymbol')
244+
->method('getCurrency')
245+
->willReturn($this->currency);
246+
$this->currency->expects($this->once())
247+
->method('getCode')
237248
->willReturn($priceCurrency);
238249
$this->customerSession->expects($this->once())
239250
->method('getCustomerGroupId')

0 commit comments

Comments
 (0)