@@ -81,21 +81,27 @@ protected function setUp()
81
81
->method ('getBlock ' )
82
82
->will ($ this ->returnValue ($ this ->priceBox ));
83
83
84
- $ storeManager = $ this ->getMockBuilder ('\Magento\Store\Model\StoreManagerInterface ' )
85
- ->setMethods (['getStore ' , 'getCode ' ])
84
+ $ cacheState = $ this ->getMockBuilder (\Magento \Framework \App \Cache \StateInterface::class)
86
85
->getMockForAbstractClass ();
87
- $ storeManager ->expects ($ this ->any ())->method ('getStore ' )->willReturnSelf ();
88
86
89
- $ appState = $ this ->getMockBuilder (' \Magento\Framework\App\State ' )
87
+ $ appState = $ this ->getMockBuilder (\Magento \Framework \App \State::class )
90
88
->disableOriginalConstructor ()
91
89
->getMock ();
92
90
93
- $ resolver = $ this ->getMockBuilder (' \Magento\Framework\View\Element\Template\File\Resolver ' )
91
+ $ resolver = $ this ->getMockBuilder (\Magento \Framework \View \Element \Template \File \Resolver::class )
94
92
->disableOriginalConstructor ()
95
93
->getMock ();
96
94
97
- $ urlBuilder = $ this ->getMockBuilder ('\Magento\Framework\UrlInterface ' )
95
+ $ urlBuilder = $ this ->getMockBuilder (\Magento \Framework \UrlInterface::class)
96
+ ->getMockForAbstractClass ();
97
+
98
+ $ store = $ this ->getMockBuilder (\Magento \Store \Api \Data \StoreInterface::class)
99
+ ->getMockForAbstractClass ();
100
+
101
+ $ storeManager = $ this ->getMockBuilder ('\Magento\Store\Model\StoreManagerInterface ' )
102
+ ->setMethods (['getStore ' , 'getCode ' ])
98
103
->getMockForAbstractClass ();
104
+ $ storeManager ->expects ($ this ->any ())->method ('getStore ' )->will ($ this ->returnValue ($ store ));
99
105
100
106
$ scopeConfigMock = $ this ->getMockForAbstractClass ('Magento\Framework\App\Config\ScopeConfigInterface ' );
101
107
$ context = $ this ->getMock ('Magento\Framework\View\Element\Template\Context ' , [], [], '' , false );
@@ -114,6 +120,9 @@ protected function setUp()
114
120
$ context ->expects ($ this ->any ())
115
121
->method ('getScopeConfig ' )
116
122
->will ($ this ->returnValue ($ scopeConfigMock ));
123
+ $ context ->expects ($ this ->any ())
124
+ ->method ('getCacheState ' )
125
+ ->will ($ this ->returnValue ($ cacheState ));
117
126
$ context ->expects ($ this ->any ())
118
127
->method ('getStoreManager ' )
119
128
->will ($ this ->returnValue ($ storeManager ));
@@ -124,7 +133,8 @@ protected function setUp()
124
133
->method ('getResolver ' )
125
134
->will ($ this ->returnValue ($ resolver ));
126
135
$ context ->expects ($ this ->any ())
127
- ->method ('getUrlBuilder ' )->will ($ this ->returnValue ($ urlBuilder ));
136
+ ->method ('getUrlBuilder ' )
137
+ ->will ($ this ->returnValue ($ urlBuilder ));
128
138
129
139
$ this ->rendererPool = $ this ->getMockBuilder ('Magento\Framework\Pricing\Render\RendererPool ' )
130
140
->disableOriginalConstructor ()
@@ -143,7 +153,7 @@ protected function setUp()
143
153
'saleableItem ' => $ this ->product ,
144
154
'rendererPool ' => $ this ->rendererPool ,
145
155
'price ' => $ this ->price ,
146
- 'data ' => ['zone ' => 'test_zone ' ]
156
+ 'data ' => ['zone ' => 'test_zone ' , ' list_category_page ' => true ]
147
157
]
148
158
);
149
159
}
@@ -240,6 +250,7 @@ public function testRenderAmountMinimal()
240
250
241
251
$ arguments = [
242
252
'zone ' => 'test_zone ' ,
253
+ 'list_category_page ' => true ,
243
254
'display_label ' => 'As low as ' ,
244
255
'price_id ' => $ priceId ,
245
256
'include_container ' => false ,
@@ -360,6 +371,12 @@ public function testHidePrice()
360
371
$ this ->assertEmpty ($ this ->object ->toHtml ());
361
372
}
362
373
374
+ public function testGetCacheKey ()
375
+ {
376
+ $ result = $ this ->object ->getCacheKey ();
377
+ $ this ->assertStringEndsWith ('list-category-page ' , $ result );
378
+ }
379
+
363
380
public function testGetCacheKeyInfo ()
364
381
{
365
382
$ this ->assertArrayHasKey ('display_minimal_price ' , $ this ->object ->getCacheKeyInfo ());
0 commit comments