Skip to content

Commit ac4653d

Browse files
author
Sergey Shvets
committed
Merge remote-tracking branch 'm2/2.0' into MAGETWO-55678
2 parents 463f485 + 36bd475 commit ac4653d

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

app/code/Magento/Catalog/Pricing/Render/FinalPriceBox.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,4 +118,16 @@ public function showMinimalPrice()
118118
&& $minimalPriceAValue
119119
&& $minimalPriceAValue < $finalPriceValue;
120120
}
121+
122+
/**
123+
* {@inheritdoc}
124+
*
125+
* @return array
126+
*/
127+
public function getCacheKeyInfo()
128+
{
129+
$cacheKeys = parent::getCacheKeyInfo();
130+
$cacheKeys['display_minimal_price'] = $this->getDisplayMinimalPrice();
131+
return $cacheKeys;
132+
}
121133
}

app/code/Magento/Catalog/Test/Unit/Pricing/Render/FinalPriceBoxTest.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,22 @@ protected function setUp()
8181
->method('getBlock')
8282
->will($this->returnValue($this->priceBox));
8383

84+
$storeManager = $this->getMockBuilder('\Magento\Store\Model\StoreManagerInterface')
85+
->setMethods(['getStore', 'getCode'])
86+
->getMockForAbstractClass();
87+
$storeManager->expects($this->any())->method('getStore')->willReturnSelf();
88+
89+
$appState = $this->getMockBuilder('\Magento\Framework\App\State')
90+
->disableOriginalConstructor()
91+
->getMock();
92+
93+
$resolver = $this->getMockBuilder('\Magento\Framework\View\Element\Template\File\Resolver')
94+
->disableOriginalConstructor()
95+
->getMock();
96+
97+
$urlBuilder = $this->getMockBuilder('\Magento\Framework\UrlInterface')
98+
->getMockForAbstractClass();
99+
84100
$scopeConfigMock = $this->getMockForAbstractClass('Magento\Framework\App\Config\ScopeConfigInterface');
85101
$context = $this->getMock('Magento\Framework\View\Element\Template\Context', [], [], '', false);
86102
$context->expects($this->any())
@@ -98,6 +114,17 @@ protected function setUp()
98114
$context->expects($this->any())
99115
->method('getScopeConfig')
100116
->will($this->returnValue($scopeConfigMock));
117+
$context->expects($this->any())
118+
->method('getStoreManager')
119+
->will($this->returnValue($storeManager));
120+
$context->expects($this->any())
121+
->method('getAppState')
122+
->will($this->returnValue($appState));
123+
$context->expects($this->any())
124+
->method('getResolver')
125+
->will($this->returnValue($resolver));
126+
$context->expects($this->any())
127+
->method('getUrlBuilder')->will($this->returnValue($urlBuilder));
101128

102129
$this->rendererPool = $this->getMockBuilder('Magento\Framework\Pricing\Render\RendererPool')
103130
->disableOriginalConstructor()
@@ -332,4 +359,9 @@ public function testHidePrice()
332359

333360
$this->assertEmpty($this->object->toHtml());
334361
}
362+
363+
public function testGetCacheKeyInfo()
364+
{
365+
$this->assertArrayHasKey('display_minimal_price', $this->object->getCacheKeyInfo());
366+
}
335367
}

0 commit comments

Comments
 (0)