@@ -254,17 +254,25 @@ public function testDeleteWithNoSuchEntityException()
254
254
$ this ->expectExceptionMessage (
255
255
'Product with SKU \'linkedProduct \' is not linked to product with SKU \'product \''
256
256
);
257
+
257
258
$ entityMock = $ this ->createMock (\Magento \Catalog \Model \ProductLink \Link::class);
258
259
$ productMock = $ this ->createMock (Product::class);
259
260
$ linkedProductMock = $ this ->createMock (Product::class);
260
- $ this ->productRepositoryMock ->expects ($ this ->exactly (2 ))->method ('get ' )->willReturnMap ([
261
- ['product ' , false , null , false , $ productMock ],
262
- ['linkedProduct ' , false , null , false , $ linkedProductMock ],
263
- ]);
261
+ $ this ->productRepositoryMock ->expects ($ this ->exactly (2 ))->method ('get ' )->willReturnMap (
262
+ [
263
+ ['product ' , false , null , false , $ productMock ],
264
+ ['linkedProduct ' , false , null , false , $ linkedProductMock ],
265
+ ]
266
+ );
264
267
$ entityMock ->expects ($ this ->exactly (2 ))->method ('getLinkedProductSku ' )->willReturn ('linkedProduct ' );
265
268
$ entityMock ->expects ($ this ->exactly (2 ))->method ('getSku ' )->willReturn ('product ' );
266
269
$ entityMock ->expects ($ this ->once ())->method ('getLinkType ' )->willReturn ('linkType ' );
267
270
$ this ->metadataPoolMock ->expects ($ this ->once ())->method ('getHydrator ' )->willReturn ($ this ->hydratorMock );
271
+
272
+ $ this ->metadataMock ->expects ($ this ->once ())->method ('getLinkField ' )->willReturn ('linkField ' );
273
+ $ this ->hydratorMock ->expects ($ this ->once ())->method ('extract ' )->willReturn (['linkField ' => 'parent_id ' ]);
274
+ $ this ->linkTypeProvider ->expects ($ this ->once ())->method ('getLinkTypes ' )->willReturn (['linkType ' => 1 ]);
275
+
268
276
$ this ->model ->delete ($ entityMock );
269
277
}
270
278
}
0 commit comments