Skip to content

Commit 2547252

Browse files
author
cspruiell
committed
MAGETWO-55126: [Backport] [API] Can not link simple product to configurable one - for 2.1.x
- update tests
1 parent 99db07c commit 2547252

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

app/code/Magento/ConfigurableProduct/Test/Unit/Model/LinkManagementTest.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,6 @@ public function testAddChild()
159159
->will(
160160
$this->returnValue([0 => [1, 2, 3]])
161161
);
162-
$configurable->expects($this->once())->method('__call')->with('setAssociatedProductIds', [[1, 2, 3, 999]]);
163162
$configurable->expects($this->once())->method('save');
164163

165164
$this->assertTrue(true, $this->object->addChild($productSku, $childSku));
@@ -203,7 +202,7 @@ public function testRemoveChild()
203202
$childSku = 'simple_10';
204203

205204
$product = $this->getMockBuilder('Magento\Catalog\Model\Product')
206-
->setMethods(['getTypeInstance', 'save', 'getTypeId', 'addData', '__wakeup'])
205+
->setMethods(['getTypeInstance', 'save', 'getTypeId', 'addData', '__wakeup', 'getExtensionAttributes'])
207206
->disableOriginalConstructor()
208207
->getMock();
209208

@@ -231,7 +230,12 @@ public function testRemoveChild()
231230
$productType->expects($this->once())->method('getUsedProducts')
232231
->will($this->returnValue([$option]));
233232

234-
$product->expects($this->once())->method('addData')->with(['associated_product_ids' => []]);
233+
$extensionAttributesMock = $this->getMockBuilder(\Magento\Framework\Api\ExtensionAttributesInterface::class)
234+
->disableOriginalConstructor()
235+
->setMethods(['setConfigurableProductLinks'])
236+
->getMock();
237+
238+
$product->expects($this->once())->method('getExtensionAttributes')->willReturn($extensionAttributesMock);
235239
$product->expects($this->once())->method('save');
236240
$this->assertTrue($this->object->removeChild($productSku, $childSku));
237241
}

0 commit comments

Comments
 (0)