Skip to content

Commit 2ed4698

Browse files
evgkdimonovp
authored andcommitted
Fix cache issue for currencies with no symbol
1 parent 447a24d commit 2ed4698

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
@@ -126,7 +126,7 @@ public function __construct(
126126
public function getCacheKeyInfo()
127127
{
128128
$parentData = parent::getCacheKeyInfo();
129-
$parentData[] = $this->priceCurrency->getCurrencySymbol();
129+
$parentData[] = $this->priceCurrency->getCurrency()->getCode();
130130
$parentData[] = $this->customerSession->getCustomerGroupId();
131131
return $parentData;
132132
}

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
*/
@@ -122,6 +127,9 @@ protected function setUp()
122127
$this->context->expects($this->once())
123128
->method('getResolver')
124129
->willReturn($fileResolverMock);
130+
$this->currency = $this->getMockBuilder(\Magento\Directory\Model\Currency::class)
131+
->disableOriginalConstructor()
132+
->getMock();
125133
$this->configurableAttributeData = $this->getMockBuilder(
126134
\Magento\ConfigurableProduct\Model\ConfigurableAttributeData::class
127135
)
@@ -192,10 +200,10 @@ public function cacheKeyProvider() : array
192200
2 => null,
193201
'base_url' => null,
194202
'template' => null,
195-
3 => '$',
203+
3 => 'USD',
196204
4 => null,
197205
],
198-
'$',
206+
'USD',
199207
null,
200208
]
201209
];
@@ -223,7 +231,10 @@ public function testGetCacheKeyInfo(array $expected, string $priceCurrency = nul
223231
->method('getStore')
224232
->willReturn($storeMock);
225233
$this->priceCurrency->expects($this->once())
226-
->method('getCurrencySymbol')
234+
->method('getCurrency')
235+
->willReturn($this->currency);
236+
$this->currency->expects($this->once())
237+
->method('getCode')
227238
->willReturn($priceCurrency);
228239
$this->customerSession->expects($this->once())
229240
->method('getCustomerGroupId')

0 commit comments

Comments
 (0)