Skip to content

Commit 488c507

Browse files
committed
MC-40044: Create automated test for: "Delete product link by API call"
1 parent 411be09 commit 488c507

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductLinkRepositoryInterfaceTest.php

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,16 @@
88

99
namespace Magento\Catalog\Api;
1010

11+
use Magento\Catalog\Model\ProductLink\Link;
1112
use Magento\Framework\ObjectManagerInterface;
1213
use Magento\Framework\Webapi\Rest\Request;
1314
use Magento\TestFramework\Helper\Bootstrap;
1415
use Magento\TestFramework\TestCase\WebapiAbstract;
1516

1617
/**
17-
* Class ProductLinkRepositoryInterfaceTest
18+
* Class checks product relations functionality
1819
*
19-
* @see \Magento\Catalog\Api\ProductLinkRepository
20+
* @see \Magento\Catalog\Api\ProductLinkRepositoryInterface
2021
*/
2122
class ProductLinkRepositoryInterfaceTest extends WebapiAbstract
2223
{
@@ -86,18 +87,20 @@ public function testDeleteNotExistedProductLink(): void
8687

8788
/**
8889
* @magentoApiDataFixture Magento/Catalog/_files/products_related.php
90+
*
91+
* @return void
8992
*/
90-
public function testSave()
93+
public function testSave(): void
9194
{
9295
$productSku = 'simple_with_cross';
9396
$linkType = 'related';
9497
$data = [
9598
'entity' => [
96-
'sku' => 'simple_with_cross',
97-
'link_type' => 'related',
98-
'linked_product_sku' => 'simple',
99-
'linked_product_type' => 'simple',
100-
'position' => 1000,
99+
Link::KEY_SKU => 'simple_with_cross',
100+
Link::KEY_LINK_TYPE => 'related',
101+
Link::KEY_LINKED_PRODUCT_SKU => 'simple',
102+
Link::KEY_LINKED_PRODUCT_TYPE => 'simple',
103+
Link::KEY_POSITION => 1000,
101104
],
102105
];
103106
$this->saveApiCall($productSku, $data);
@@ -158,11 +161,11 @@ private function deleteApiCall(string $productSku, string $linkType, string $lin
158161
/**
159162
* Make api call to save product link
160163
*
161-
* @param $productSku
162-
* @param $data
164+
* @param string $productSku
165+
* @param array $data
163166
* @return array|bool|float|int|string
164167
*/
165-
private function saveApiCall($productSku, $data)
168+
private function saveApiCall(string $productSku, array $data)
166169
{
167170
$serviceInfo = $this->getServiceInfo(
168171
$productSku . '/links',

0 commit comments

Comments
 (0)