Skip to content

Commit bdbb253

Browse files
committed
AC-13311: Invalid SKU Handling for Linked Products in Magento
1 parent aa1a36f commit bdbb253

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,4 +298,16 @@ public function testDeleteWithNoSuchEntityException()
298298

299299
$this->model->delete($entityMock);
300300
}
301+
302+
public function testSaveWithNullLinkedProductSku()
303+
{
304+
$this->expectException('Magento\Framework\Exception\CouldNotSaveException');
305+
$this->expectExceptionMessage('The linked product SKU is invalid. Verify the data and try again.');
306+
307+
$entityMock = $this->createMock(\Magento\Catalog\Model\ProductLink\Link::class);
308+
$entityMock->expects($this->any())->method('getSku')->willReturn('sku1');
309+
$entityMock->expects($this->any())->method('getLinkedProductSku')->willReturn(null);
310+
311+
$this->model->save($entityMock);
312+
}
301313
}

0 commit comments

Comments
 (0)