Skip to content

Commit e133e1f

Browse files
MC-36960: Create automated test for "Create product for "all" store views using API service"
1 parent a7bf26f commit e133e1f

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductRepositoryAllStoreViewsTest.php

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Magento\Catalog\Model\Product\Type;
1414
use Magento\Catalog\Model\Product\Visibility;
1515
use Magento\Catalog\Model\ResourceModel\Product\Website\Link;
16+
use Magento\CatalogInventory\Api\Data\StockItemInterface;
1617
use Magento\Eav\Model\Config;
1718
use Magento\Framework\Exception\NoSuchEntityException;
1819
use Magento\Framework\ObjectManagerInterface;
@@ -167,7 +168,31 @@ private function getProductData(): array
167168
ProductInterface::STATUS => Status::STATUS_ENABLED,
168169
ProductInterface::VISIBILITY => Visibility::VISIBILITY_BOTH,
169170
ProductInterface::EXTENSION_ATTRIBUTES_KEY => [
170-
'stock_item' => ['is_in_stock' => true, 'qty' => 1000]
171+
'stock_item' => [
172+
StockItemInterface::IS_IN_STOCK => 1,
173+
StockItemInterface::QTY => 1000,
174+
StockItemInterface::IS_QTY_DECIMAL => 0,
175+
StockItemInterface::SHOW_DEFAULT_NOTIFICATION_MESSAGE => 0,
176+
StockItemInterface::USE_CONFIG_MIN_QTY => 0,
177+
StockItemInterface::USE_CONFIG_MIN_SALE_QTY => 0,
178+
StockItemInterface::MIN_QTY => 1,
179+
StockItemInterface::MIN_SALE_QTY => 1,
180+
StockItemInterface::MAX_SALE_QTY => 100,
181+
StockItemInterface::USE_CONFIG_MAX_SALE_QTY => 0,
182+
StockItemInterface::USE_CONFIG_BACKORDERS => 0,
183+
StockItemInterface::BACKORDERS => 0,
184+
StockItemInterface::USE_CONFIG_NOTIFY_STOCK_QTY => 0,
185+
StockItemInterface::NOTIFY_STOCK_QTY => 0,
186+
StockItemInterface::USE_CONFIG_QTY_INCREMENTS => 0,
187+
StockItemInterface::QTY_INCREMENTS => 0,
188+
StockItemInterface::USE_CONFIG_ENABLE_QTY_INC => 0,
189+
StockItemInterface::ENABLE_QTY_INCREMENTS => 0,
190+
StockItemInterface::USE_CONFIG_MANAGE_STOCK => 1,
191+
StockItemInterface::MANAGE_STOCK => 1,
192+
StockItemInterface::LOW_STOCK_DATE => null,
193+
StockItemInterface::IS_DECIMAL_DIVIDED => 0,
194+
StockItemInterface::STOCK_STATUS_CHANGED_AUTO => 0,
195+
],
171196
],
172197
ProductInterface::CUSTOM_ATTRIBUTES => [
173198
['attribute_code' => 'url_key', 'value' => 'simple'],
@@ -211,6 +236,10 @@ private function assertProductData(array $productData, array $resultData, array
211236
$resultData['custom_attributes'],
212237
$attribute['attribute_code']
213238
);
239+
if ($attribute['attribute_code'] == 'category_ids') {
240+
$this->assertEquals(array_values($attribute['value']), array_values($resultAttribute['value']));
241+
continue;
242+
}
214243
$this->assertEquals($attribute['value'], $resultAttribute['value']);
215244
}
216245
foreach ($productData['extension_attributes']['stock_item'] as $key => $value) {

0 commit comments

Comments
 (0)