9
9
namespace Magento \ConfigurableProduct \Api ;
10
10
11
11
use Magento \TestFramework \Helper \Bootstrap ;
12
+ use Magento \Catalog \Model \ProductRepository ;
12
13
use Magento \Eav \Api \AttributeRepositoryInterface ;
13
14
14
15
/**
15
16
* Class OptionRepositoryTest for testing ConfigurableProductoption integration
16
17
*/
17
18
class OptionRepositoryTest extends \Magento \TestFramework \TestCase \WebapiAbstract
18
19
{
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 ' ;
22
23
23
24
/**
24
25
* @magentoApiDataFixture Magento/ConfigurableProduct/_files/product_configurable.php
@@ -166,6 +167,9 @@ public function testAdd(): void
166
167
$ attribute = $ attributeRepository ->get ('catalog_product ' , 'test_configurable ' );
167
168
168
169
$ productSku = 'simple ' ;
170
+ $ productRepository = Bootstrap::getObjectManager ()->create (ProductRepository::class);
171
+ $ product = $ productRepository ->get ($ productSku );
172
+ $ this ->assertEquals ('simple ' , $ product ->getTypeId ());
169
173
$ serviceInfo = [
170
174
'rest ' => [
171
175
'resourcePath ' => self ::RESOURCE_PATH . '/ ' . $ productSku . '/options ' ,
@@ -189,6 +193,9 @@ public function testAdd(): void
189
193
/** @var int $result */
190
194
$ result = $ this ->_webApiCall ($ serviceInfo , ['sku ' => $ productSku , 'option ' => $ option ]);
191
195
$ this ->assertGreaterThan (0 , $ result );
196
+ $ updatedproductRepo = Bootstrap::getObjectManager ()->create (ProductRepository::class);
197
+ $ updatedproduct = $ updatedproductRepo ->get ($ productSku );
198
+ $ this ->assertEquals ('configurable ' , $ updatedproduct ->getTypeId ());
192
199
}
193
200
194
201
/**
0 commit comments