32 public function testDelete()
34 $productSku =
'simple_with_cross';
35 $linkedSku =
'simple';
36 $linkType =
'related';
40 'resourcePath' => self::RESOURCE_PATH . $productSku .
'/links/' . $linkType .
'/' . $linkedSku,
44 'service' => self::SERVICE_NAME,
45 'serviceVersion' => self::SERVICE_VERSION,
46 'operation' => self::SERVICE_NAME .
'DeleteById',
52 'linkedProductSku' => $linkedSku
56 $linkManagement = $this->objectManager->create(\
Magento\Catalog\Api\ProductLinkManagementInterface::class);
57 $linkedProducts =
$linkManagement->getLinkedItemsByType($productSku, $linkType);
58 $this->assertCount(1, $linkedProducts);
61 $this->assertEquals(
$product->getLinkedProductSku(),
'simple_with_cross_two');
67 public function testSave()
69 $productSku =
'simple_with_cross';
70 $linkType =
'related';
74 'resourcePath' => self::RESOURCE_PATH . $productSku .
'/links',
80 'operation' => self::SERVICE_NAME .
'Save',
88 'sku' =>
'simple_with_cross',
89 'link_type' =>
'related',
90 'linked_product_sku' =>
'simple',
91 'linked_product_type' =>
'simple',
99 $actual =
$linkManagement->getLinkedItemsByType($productSku, $linkType);
100 $this->assertCount(1, $actual,
'Invalid actual linked products count');
101 $this->assertEquals(1000, $actual[0]->getPosition(),
'Product position is not updated');
_webApiCall( $serviceInfo, $arguments=[], $webApiAdapterCode=null, $storeCode=null, $integration=null)
static getObjectManager()