@@ -148,7 +148,7 @@ protected function setUp()
148
148
$ this ->priceCurrency = $ this ->getMock ('Magento\Framework\Pricing\PriceCurrencyInterface ' );
149
149
$ this ->dateFormat = $ this ->getMock ('Magento\Framework\Stdlib\DateTime ' , [], [], '' , false );
150
150
$ this ->dateTime = $ this ->getMock ('Magento\Framework\Stdlib\DateTime\DateTime ' , [], [], '' , false );
151
- $ this ->eavConfig = $ this ->getMock ('Magento\Eav\Model\Config ' , [], [], '' , false );
151
+ $ this ->eavConfig = $ this ->getMock ('Magento\Eav\Model\Config ' , [' getAttribute ' ], [], '' , false );
152
152
$ this ->product = $ this ->getMock ('Magento\Catalog\Model\Product ' , [], [], '' , false );
153
153
$ this ->productFactory = $ this ->getMock ('Magento\Catalog\Model\ProductFactory ' , ['create ' ], [], '' , false );
154
154
@@ -182,7 +182,6 @@ protected function setUp()
182
182
183
183
$ this ->combine ->expects ($ this ->any ())->method ('validate ' )->will ($ this ->returnValue (true ));
184
184
$ this ->attribute ->expects ($ this ->any ())->method ('getBackend ' )->will ($ this ->returnValue ($ this ->backend ));
185
- $ this ->eavConfig ->expects ($ this ->any ())->method ('getAttribute ' )->will ($ this ->returnValue ($ this ->attribute ));
186
185
$ this ->productFactory ->expects ($ this ->any ())->method ('create ' )->will ($ this ->returnValue ($ this ->product ));
187
186
188
187
$ this ->indexBuilder = new \Magento \CatalogRule \Model \Indexer \IndexBuilder (
@@ -206,6 +205,45 @@ protected function setUp()
206
205
*/
207
206
public function testUpdateCatalogRuleGroupWebsiteData ()
208
207
{
208
+ $ groupPriceAttrMock = $ this ->getMock (
209
+ 'Magento\Catalog\Model\Entity\Attribute ' ,
210
+ ['getBackend ' ],
211
+ [],
212
+ '' ,
213
+ false
214
+ );
215
+ $ backendModelMock = $ this ->getMock (
216
+ 'Magento\Catalog\Model\Product\Attribute\Backend\GroupPrice ' ,
217
+ ['getResource ' ],
218
+ [],
219
+ '' ,
220
+ false
221
+ );
222
+ $ resourceMock = $ this ->getMock (
223
+ 'Magento\Catalog\Model\Resource\Product\Attribute\Backend\GroupPrice ' ,
224
+ ['getMainTable ' ],
225
+ [],
226
+ '' ,
227
+ false
228
+ );
229
+ $ resourceMock ->expects ($ this ->once ())
230
+ ->method ('getMainTable ' )
231
+ ->will ($ this ->returnValue ('catalog_product_entity_group_price ' ));
232
+ $ backendModelMock ->expects ($ this ->once ())
233
+ ->method ('getResource ' )
234
+ ->will ($ this ->returnValue ($ resourceMock ));
235
+ $ groupPriceAttrMock ->expects ($ this ->once ())
236
+ ->method ('getBackend ' )
237
+ ->will ($ this ->returnValue ($ backendModelMock ));
238
+ $ this ->eavConfig ->expects ($ this ->at (0 ))
239
+ ->method ('getAttribute ' )
240
+ ->with (\Magento \Catalog \Model \Product::ENTITY , 'group_price ' )
241
+ ->will ($ this ->returnValue ($ groupPriceAttrMock ));
242
+ $ this ->eavConfig ->expects ($ this ->at (1 ))
243
+ ->method ('getAttribute ' )
244
+ ->with (\Magento \Catalog \Model \Product::ENTITY , 'price ' )
245
+ ->will ($ this ->returnValue ($ this ->attribute ));
246
+
209
247
$ this ->select ->expects ($ this ->once ())->method ('insertFromSelect ' )->with ('catalogrule_group_website ' );
210
248
211
249
$ this ->indexBuilder ->reindexByIds ([1 ]);
0 commit comments