diff --git a/app/code/Magento/ConfigurableProduct/Block/Product/View/Type/Configurable.php b/app/code/Magento/ConfigurableProduct/Block/Product/View/Type/Configurable.php index b5d02f64e6eb5..08f5bbf1383a2 100644 --- a/app/code/Magento/ConfigurableProduct/Block/Product/View/Type/Configurable.php +++ b/app/code/Magento/ConfigurableProduct/Block/Product/View/Type/Configurable.php @@ -126,7 +126,7 @@ public function __construct( public function getCacheKeyInfo() { $parentData = parent::getCacheKeyInfo(); - $parentData[] = $this->priceCurrency->getCurrencySymbol(); + $parentData[] = $this->priceCurrency->getCurrency()->getCode(); $parentData[] = $this->customerSession->getCustomerGroupId(); return $parentData; } diff --git a/app/code/Magento/ConfigurableProduct/Test/Unit/Block/Product/View/Type/ConfigurableTest.php b/app/code/Magento/ConfigurableProduct/Test/Unit/Block/Product/View/Type/ConfigurableTest.php index 1908d897be6da..db3c30e3b4e33 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Unit/Block/Product/View/Type/ConfigurableTest.php +++ b/app/code/Magento/ConfigurableProduct/Test/Unit/Block/Product/View/Type/ConfigurableTest.php @@ -48,6 +48,11 @@ class ConfigurableTest extends \PHPUnit\Framework\TestCase */ private $priceCurrency; + /** + * @var \Magento\Directory\Model\Currency|\PHPUnit_Framework_MockObject_MockObject + */ + private $currency; + /** * @var \Magento\ConfigurableProduct\Model\ConfigurableAttributeData|\PHPUnit_Framework_MockObject_MockObject */ @@ -122,6 +127,9 @@ protected function setUp() $this->context->expects($this->once()) ->method('getResolver') ->willReturn($fileResolverMock); + $this->currency = $this->getMockBuilder(\Magento\Directory\Model\Currency::class) + ->disableOriginalConstructor() + ->getMock(); $this->configurableAttributeData = $this->getMockBuilder( \Magento\ConfigurableProduct\Model\ConfigurableAttributeData::class ) @@ -192,10 +200,10 @@ public function cacheKeyProvider() : array 2 => null, 'base_url' => null, 'template' => null, - 3 => '$', + 3 => 'USD', 4 => null, ], - '$', + 'USD', null, ] ]; @@ -223,7 +231,10 @@ public function testGetCacheKeyInfo(array $expected, string $priceCurrency = nul ->method('getStore') ->willReturn($storeMock); $this->priceCurrency->expects($this->once()) - ->method('getCurrencySymbol') + ->method('getCurrency') + ->willReturn($this->currency); + $this->currency->expects($this->once()) + ->method('getCode') ->willReturn($priceCurrency); $this->customerSession->expects($this->once()) ->method('getCustomerGroupId')