Skip to content

Commit 129f24f

Browse files
author
Roman Lytvynenko
committed
MAGETWO-99500: Configurable options attribute position is not saved correctly via API
1 parent 108cb6a commit 129f24f

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public function testAddChild()
158158
->getMock();
159159
$optionMock = $this->getMockBuilder(\Magento\ConfigurableProduct\Api\Data\Option::class)
160160
->disableOriginalConstructor()
161-
->setMethods(['getProductAttribute', 'getAttributeId'])
161+
->setMethods(['getProductAttribute', 'getPosition', 'getAttributeId'])
162162
->getMock();
163163
$productAttributeMock = $this->getMockBuilder(\Magento\Eav\Model\Entity\Attribute\AbstractAttribute::class)
164164
->disableOriginalConstructor()
@@ -216,13 +216,15 @@ public function testAddChild()
216216
$productAttributeMock->expects($this->any())->method('getAttributeCode')->willReturn('color');
217217
$simple->expects($this->any())->method('getData')->willReturn('color');
218218
$optionMock->expects($this->any())->method('getAttributeId')->willReturn('1');
219+
$optionMock->expects($this->any())->method('getPosition')->willReturn('0');
219220

220221
$optionsFactoryMock->expects($this->any())->method('create')->willReturn([$optionMock]);
221222
$attributeFactoryMock->expects($this->any())->method('create')->willReturn($attributeMock);
222223
$attributeMock->expects($this->any())->method('getCollection')->willReturn($attributeCollectionMock);
223224
$attributeCollectionMock->expects($this->any())->method('addFieldToFilter')->willReturnSelf();
224225
$attributeCollectionMock->expects($this->any())->method('getItems')->willReturn([$attributeMock]);
225226

227+
$attributeMock->expects($this->any())->method('getId')->willReturn(1);
226228
$attributeMock->expects($this->any())->method('getOptions')->willReturn([$attributeOptionMock]);
227229

228230
$extensionAttributesMock->expects($this->any())->method('setConfigurableProductOptions');

dev/tests/api-functional/testsuite/Magento/ConfigurableProduct/Api/LinkManagementTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
use Magento\Framework\Webapi\Rest\Request;
1313
use Magento\TestFramework\TestCase\WebapiAbstract;
1414

15+
/**
16+
* Class LinkManagementTest for testing ConfigurableProduct to SimpleProduct link functionality
17+
*/
1518
class LinkManagementTest extends WebapiAbstract
1619
{
1720
const SERVICE_NAME = 'configurableProductLinkManagementV1';

0 commit comments

Comments
 (0)