@@ -230,46 +230,6 @@ public function testAddProductCategoriesFilter()
230
230
$ this ->collection ->addCategoriesFilter ([$ conditionType => $ values ]);
231
231
}
232
232
233
- public function testAddMediaGalleryData ()
234
- {
235
- $ attributeId = 42 ;
236
- $ rowId = 4 ;
237
- $ linkField = 'row_id ' ;
238
- $ mediaGalleriesMock = [[$ linkField => $ rowId ]];
239
- $ itemMock = $ this ->getMockBuilder (\Magento \Catalog \Model \Product::class)
240
- ->disableOriginalConstructor ()
241
- ->setMethods (['getOrigData ' ])
242
- ->getMock ();
243
- $ attributeMock = $ this ->getMockBuilder (\Magento \Eav \Model \Entity \Attribute \AbstractAttribute::class)
244
- ->disableOriginalConstructor ()
245
- ->getMock ();
246
- $ selectMock = $ this ->getMockBuilder (\Magento \Framework \DB \Select::class)
247
- ->disableOriginalConstructor ()
248
- ->getMock ();
249
- $ metadataMock = $ this ->getMockBuilder (\Magento \Framework \EntityManager \EntityMetadataInterface::class)
250
- ->disableOriginalConstructor ()
251
- ->getMock ();
252
- $ this ->collection ->addItem ($ itemMock );
253
- $ this ->galleryResourceMock ->expects ($ this ->once ())->method ('createBatchBaseSelect ' )->willReturn ($ selectMock );
254
- $ attributeMock ->expects ($ this ->once ())->method ('getAttributeId ' )->willReturn ($ attributeId );
255
- $ this ->entityMock ->expects ($ this ->once ())->method ('getAttribute ' )->willReturn ($ attributeMock );
256
- $ itemMock ->expects ($ this ->atLeastOnce ())->method ('getOrigData ' )->willReturn ($ rowId );
257
- $ selectMock ->expects ($ this ->once ())->method ('reset ' )->with (Select::ORDER )->willReturnSelf ();
258
- $ selectMock ->expects ($ this ->once ())->method ('where ' )->with ('entity. ' . $ linkField . ' IN (?) ' , [$ rowId ])
259
- ->willReturnSelf ();
260
- $ this ->metadataPoolMock ->expects ($ this ->once ())->method ('getMetadata ' )->willReturn ($ metadataMock );
261
- $ metadataMock ->expects ($ this ->once ())->method ('getLinkField ' )->willReturn ($ linkField );
262
-
263
- $ this ->connectionMock ->expects ($ this ->once ())->method ('fetchOne ' )->with ($ selectMock )->willReturn (42 );
264
- $ this ->connectionMock ->expects ($ this ->once ())->method ('fetchAll ' )->with ($ selectMock )->willReturn (
265
- [['row_id ' => $ rowId ]]
266
- );
267
- $ this ->galleryReadHandlerMock ->expects ($ this ->once ())->method ('addMediaDataToProduct ' )
268
- ->with ($ itemMock , $ mediaGalleriesMock );
269
-
270
- $ this ->assertSame ($ this ->collection , $ this ->collection ->addMediaGalleryData ());
271
- }
272
-
273
233
/**
274
234
* Test addTierPriceDataByGroupId method.
275
235
*
0 commit comments