99namespace Magento \ConfigurableProduct \Api ;
1010
1111use Magento \TestFramework \Helper \Bootstrap ;
12+ use Magento \Catalog \Model \ProductRepository ;
1213use Magento \Eav \Api \AttributeRepositoryInterface ;
1314
1415/**
1516 * Class OptionRepositoryTest for testing ConfigurableProductoption integration
1617 */
1718class OptionRepositoryTest extends \Magento \TestFramework \TestCase \WebapiAbstract
1819{
19- const SERVICE_NAME = 'configurableProductOptionRepositoryV1 ' ;
20- const SERVICE_VERSION = 'V1 ' ;
21- const RESOURCE_PATH = '/V1/configurable-products ' ;
20+ public const SERVICE_NAME = 'configurableProductOptionRepositoryV1 ' ;
21+ public const SERVICE_VERSION = 'V1 ' ;
22+ public const RESOURCE_PATH = '/V1/configurable-products ' ;
2223
2324 /**
2425 * @magentoApiDataFixture Magento/ConfigurableProduct/_files/product_configurable.php
@@ -166,6 +167,9 @@ public function testAdd(): void
166167 $ attribute = $ attributeRepository ->get ('catalog_product ' , 'test_configurable ' );
167168
168169 $ productSku = 'simple ' ;
170+ $ productRepository = Bootstrap::getObjectManager ()->create (ProductRepository::class);
171+ $ product = $ productRepository ->get ($ productSku );
172+ $ this ->assertEquals ('simple ' , $ product ->getTypeId ());
169173 $ serviceInfo = [
170174 'rest ' => [
171175 'resourcePath ' => self ::RESOURCE_PATH . '/ ' . $ productSku . '/options ' ,
@@ -189,6 +193,9 @@ public function testAdd(): void
189193 /** @var int $result */
190194 $ result = $ this ->_webApiCall ($ serviceInfo , ['sku ' => $ productSku , 'option ' => $ option ]);
191195 $ this ->assertGreaterThan (0 , $ result );
196+ $ updatedproductRepo = Bootstrap::getObjectManager ()->create (ProductRepository::class);
197+ $ updatedproduct = $ updatedproductRepo ->get ($ productSku );
198+ $ this ->assertEquals ('configurable ' , $ updatedproduct ->getTypeId ());
192199 }
193200
194201 /**
0 commit comments