Skip to content

Commit 4f5bd10

Browse files
committed
ACP2E-412: Cant link configurable options with REST to product created on Backend
1 parent bb3b2f0 commit 4f5bd10

File tree

2 files changed

+4
-48
lines changed

2 files changed

+4
-48
lines changed

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

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,9 @@
99
namespace Magento\ConfigurableProduct\Api;
1010

1111
use Magento\Catalog\Model\ResourceModel\Eav\Attribute;
12-
use Magento\Eav\Api\AttributeRepositoryInterface;
1312
use Magento\Eav\Model\AttributeRepository;
1413
use Magento\Eav\Model\Entity\Attribute\Option;
1514
use Magento\Framework\Webapi\Rest\Request;
16-
use Magento\TestFramework\Helper\Bootstrap;
1715
use Magento\TestFramework\TestCase\WebapiAbstract;
1816

1917
/**
@@ -89,52 +87,6 @@ public function testAddChild(): void
8987
$this->assertTrue($res);
9088
}
9189

92-
/**
93-
* @magentoApiDataFixture Magento/Catalog/_files/product_simple.php
94-
* @magentoApiDataFixture Magento/ConfigurableProduct/_files/configurable_attribute.php
95-
* @magentoApiDataFixture Magento/ConfigurableProduct/_files/product_simple_77.php
96-
* @magentoApiDataFixture Magento/ConfigurableProduct/_files/delete_association.php
97-
*
98-
* @return void
99-
*/
100-
public function testAddChildToConfigurableProdWithoutOption(): void
101-
{
102-
/** @var AttributeRepositoryInterface $attributeRepository */
103-
$attributeRepository = Bootstrap::getObjectManager()->create(AttributeRepositoryInterface::class);
104-
105-
/** @var \Magento\Eav\Api\Data\AttributeInterface $attribute */
106-
$attribute = $attributeRepository->get('catalog_product', 'test_configurable');
107-
108-
$productSku = 'simple';
109-
$serviceInfo = [
110-
'rest' => [
111-
'resourcePath' => self::RESOURCE_PATH . '/' . $productSku . '/options',
112-
'httpMethod' => Request::HTTP_METHOD_POST
113-
],
114-
'soap' => [
115-
'service' => self::SERVICE_NAME,
116-
'serviceVersion' => self::SERVICE_VERSION,
117-
'operation' => self::SERVICE_NAME . 'Save'
118-
]
119-
];
120-
$option = [
121-
'attribute_id' => $attribute->getAttributeId(),
122-
'label' => 'Test',
123-
'values' => [
124-
[
125-
'value_index' => 1,
126-
]
127-
],
128-
];
129-
/** @var int $result */
130-
$result = $this->_webApiCall($serviceInfo, ['sku' => $productSku, 'option' => $option]);
131-
$this->assertGreaterThan(0, $result);
132-
133-
$childSku = 'simple_77';
134-
$res = $this->addChild($productSku, $childSku);
135-
$this->assertTrue($res);
136-
}
137-
13890
/**
13991
* Test the full flow of creating a configurable product and adding a child via REST
14092
*

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
namespace Magento\ConfigurableProduct\Api;
1010

11+
use Magento\Catalog\Model\ProductRepository;
1112
use Magento\TestFramework\Helper\Bootstrap;
1213
use Magento\Eav\Api\AttributeRepositoryInterface;
1314

@@ -166,6 +167,8 @@ public function testAdd(): void
166167
$attribute = $attributeRepository->get('catalog_product', 'test_configurable');
167168

168169
$productSku = 'simple';
170+
$product = $this->objectManager->create(ProductRepository::class)->get($productSku);
171+
$this->assertEquals('simple', $product->getTypeId());
169172
$serviceInfo = [
170173
'rest' => [
171174
'resourcePath' => self::RESOURCE_PATH . '/' . $productSku . '/options',
@@ -188,6 +191,7 @@ public function testAdd(): void
188191
];
189192
/** @var int $result */
190193
$result = $this->_webApiCall($serviceInfo, ['sku' => $productSku, 'option' => $option]);
194+
$this->assertEquals('configurable', $product->getTypeId());
191195
$this->assertGreaterThan(0, $result);
192196
}
193197

0 commit comments

Comments
 (0)