|
13 | 13 | use Magento\Catalog\Model\Product\Type;
|
14 | 14 | use Magento\Catalog\Model\Product\Visibility;
|
15 | 15 | use Magento\Catalog\Model\ResourceModel\Product\Website\Link;
|
| 16 | +use Magento\CatalogInventory\Api\Data\StockItemInterface; |
16 | 17 | use Magento\Eav\Model\Config;
|
17 | 18 | use Magento\Framework\Exception\NoSuchEntityException;
|
18 | 19 | use Magento\Framework\ObjectManagerInterface;
|
@@ -167,7 +168,31 @@ private function getProductData(): array
|
167 | 168 | ProductInterface::STATUS => Status::STATUS_ENABLED,
|
168 | 169 | ProductInterface::VISIBILITY => Visibility::VISIBILITY_BOTH,
|
169 | 170 | 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 | + ], |
171 | 196 | ],
|
172 | 197 | ProductInterface::CUSTOM_ATTRIBUTES => [
|
173 | 198 | ['attribute_code' => 'url_key', 'value' => 'simple'],
|
@@ -211,6 +236,10 @@ private function assertProductData(array $productData, array $resultData, array
|
211 | 236 | $resultData['custom_attributes'],
|
212 | 237 | $attribute['attribute_code']
|
213 | 238 | );
|
| 239 | + if ($attribute['attribute_code'] == 'category_ids') { |
| 240 | + $this->assertEquals(array_values($attribute['value']), array_values($resultAttribute['value'])); |
| 241 | + continue; |
| 242 | + } |
214 | 243 | $this->assertEquals($attribute['value'], $resultAttribute['value']);
|
215 | 244 | }
|
216 | 245 | foreach ($productData['extension_attributes']['stock_item'] as $key => $value) {
|
|
0 commit comments