Skip to content

Commit f952ca9

Browse files
committed
#28081 Add missing stub key that caused Unit Test failure
1 parent 67abbb3 commit f952ca9

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

app/code/Magento/Catalog/Test/Unit/Model/ProductLink/RepositoryTest.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,17 +254,25 @@ public function testDeleteWithNoSuchEntityException()
254254
$this->expectExceptionMessage(
255255
'Product with SKU \'linkedProduct\' is not linked to product with SKU \'product\''
256256
);
257+
257258
$entityMock = $this->createMock(\Magento\Catalog\Model\ProductLink\Link::class);
258259
$productMock = $this->createMock(Product::class);
259260
$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+
);
264267
$entityMock->expects($this->exactly(2))->method('getLinkedProductSku')->willReturn('linkedProduct');
265268
$entityMock->expects($this->exactly(2))->method('getSku')->willReturn('product');
266269
$entityMock->expects($this->once())->method('getLinkType')->willReturn('linkType');
267270
$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+
268276
$this->model->delete($entityMock);
269277
}
270278
}

0 commit comments

Comments
 (0)