|
| 1 | +<?php |
| 2 | +/** |
| 3 | + * Copyright © Magento, Inc. All rights reserved. |
| 4 | + * See COPYING.txt for license details. |
| 5 | + */ |
| 6 | + |
| 7 | +/** @var $product \Magento\Catalog\Model\Product */ |
| 8 | +$product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Product::class); |
| 9 | +$product->isObjectNew(true); |
| 10 | +$product->setTypeId(\Magento\Catalog\Model\Product\Type::TYPE_SIMPLE) |
| 11 | + ->setAttributeSetId(4) |
| 12 | + ->setName('Simple Product') |
| 13 | + ->setSku('simple_saleable') |
| 14 | + ->setTaxClassId('none') |
| 15 | + ->setDescription('description') |
| 16 | + ->setShortDescription('short description') |
| 17 | + ->setOptionsContainer('container1') |
| 18 | + ->setMsrpDisplayActualPriceType(\Magento\Msrp\Model\Product\Attribute\Source\Type::TYPE_IN_CART) |
| 19 | + ->setPrice(10) |
| 20 | + ->setWeight(1) |
| 21 | + ->setMetaTitle('meta title') |
| 22 | + ->setMetaKeyword('meta keyword') |
| 23 | + ->setMetaDescription('meta description') |
| 24 | + ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH) |
| 25 | + ->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED) |
| 26 | + ->setWebsiteIds([1]) |
| 27 | + ->setCateroryIds([]) |
| 28 | + ->setStockData(['use_config_manage_stock' => 1, 'qty' => 100, 'is_qty_decimal' => 0, 'is_in_stock' => 1]) |
| 29 | + ->save(); |
| 30 | + |
| 31 | +$product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Product::class); |
| 32 | +$product->isObjectNew(true); |
| 33 | +$product->setTypeId(\Magento\Catalog\Model\Product\Type::TYPE_SIMPLE) |
| 34 | + ->setAttributeSetId(4) |
| 35 | + ->setName('Simple Product2') |
| 36 | + ->setSku('simple_not_saleable') |
| 37 | + ->setTaxClassId('none') |
| 38 | + ->setDescription('description') |
| 39 | + ->setShortDescription('short description') |
| 40 | + ->setOptionsContainer('container1') |
| 41 | + ->setMsrpDisplayActualPriceType(\Magento\Msrp\Model\Product\Attribute\Source\Type::TYPE_ON_GESTURE) |
| 42 | + ->setPrice(20) |
| 43 | + ->setWeight(1) |
| 44 | + ->setMetaTitle('meta title') |
| 45 | + ->setMetaKeyword('meta keyword') |
| 46 | + ->setMetaDescription('meta description') |
| 47 | + ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_IN_CATALOG) |
| 48 | + ->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED) |
| 49 | + ->setWebsiteIds([1]) |
| 50 | + ->setCateroryIds([]) |
| 51 | + ->setStockData(['use_config_manage_stock' => 1, 'qty' => 50, 'is_qty_decimal' => 0, 'is_in_stock' => 0]) |
| 52 | + ->save(); |
0 commit comments