|
| 1 | +<?php |
| 2 | +/** |
| 3 | + * Copyright © Magento, Inc. All rights reserved. |
| 4 | + * See COPYING.txt for license details. |
| 5 | + */ |
| 6 | +declare(strict_types=1); |
| 7 | + |
| 8 | +/** @var \Magento\Catalog\Model\Category $category */ |
| 9 | +$category = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Category::class); |
| 10 | +$category->isObjectNew(true); |
| 11 | +$category->setId( |
| 12 | + 300 |
| 13 | +)->setCreatedAt( |
| 14 | + '2014-06-23 09:50:07' |
| 15 | +)->setName( |
| 16 | + 'Category 300' |
| 17 | +)->setParentId( |
| 18 | + 2 |
| 19 | +)->setPath( |
| 20 | + '1/2/3' |
| 21 | +)->setLevel( |
| 22 | + 2 |
| 23 | +)->setAvailableSortBy( |
| 24 | + 'name' |
| 25 | +)->setDefaultSortBy( |
| 26 | + 'name' |
| 27 | +)->setIsActive( |
| 28 | + true |
| 29 | +)->setPosition( |
| 30 | + 1 |
| 31 | +)->setAvailableSortBy( |
| 32 | + ['position'] |
| 33 | +)->save(); |
| 34 | + |
| 35 | +/** @var $product \Magento\Catalog\Model\Product */ |
| 36 | +$product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Product::class); |
| 37 | +$product->isObjectNew(true); |
| 38 | +$product->setTypeId(\Magento\Catalog\Model\Product\Type::TYPE_SIMPLE) |
| 39 | + ->setId(64) |
| 40 | + ->setAttributeSetId(4) |
| 41 | + ->setName('Simple Product OOS') |
| 42 | + ->setSku('simple_oos') |
| 43 | + ->setTaxClassId('none') |
| 44 | + ->setDescription('description') |
| 45 | + ->setShortDescription('short description') |
| 46 | + ->setOptionsContainer('container1') |
| 47 | + ->setMsrpDisplayActualPriceType(\Magento\Msrp\Model\Product\Attribute\Source\Type::TYPE_IN_CART) |
| 48 | + ->setPrice(10) |
| 49 | + ->setWeight(1) |
| 50 | + ->setMetaTitle('meta title') |
| 51 | + ->setMetaKeyword('meta keyword') |
| 52 | + ->setMetaDescription('meta description') |
| 53 | + ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH) |
| 54 | + ->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED) |
| 55 | + ->setWebsiteIds([1]) |
| 56 | + ->setCateroryIds([]) |
| 57 | + ->setCategoryIds( |
| 58 | + [300]) |
| 59 | + ->setStockData(['use_config_manage_stock' => 1, 'qty' => 0, 'is_qty_decimal' => 0, 'is_in_stock' => 0]) |
| 60 | + ->setSpecialPrice('5.99') |
| 61 | + ->save(); |
| 62 | + |
| 63 | +$product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Product::class); |
| 64 | +$product->isObjectNew(true); |
| 65 | +$product->setTypeId(\Magento\Catalog\Model\Product\Type::TYPE_SIMPLE) |
| 66 | + ->setId(65) |
| 67 | + ->setAttributeSetId(4) |
| 68 | + ->setName('Simple Product Not Visible') |
| 69 | + ->setSku('simple2_not_visible') |
| 70 | + ->setTaxClassId('none') |
| 71 | + ->setDescription('description') |
| 72 | + ->setShortDescription('short description') |
| 73 | + ->setOptionsContainer('container1') |
| 74 | + ->setMsrpDisplayActualPriceType(\Magento\Msrp\Model\Product\Attribute\Source\Type::TYPE_ON_GESTURE) |
| 75 | + ->setPrice(20) |
| 76 | + ->setWeight(1) |
| 77 | + ->setMetaTitle('meta title') |
| 78 | + ->setMetaKeyword('meta keyword') |
| 79 | + ->setMetaDescription('meta description') |
| 80 | + ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_NOT_VISIBLE) |
| 81 | + ->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED) |
| 82 | + ->setWebsiteIds([1]) |
| 83 | + ->setCategoryIds( |
| 84 | + [300]) |
| 85 | + ->setStockData(['use_config_manage_stock' => 1, 'qty' => 50, 'is_qty_decimal' => 0, 'is_in_stock' => 1]) |
| 86 | + ->setSpecialPrice('15.99') |
| 87 | + ->save(); |
| 88 | + |
| 89 | +$product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Product::class); |
| 90 | +$product->isObjectNew(true); |
| 91 | +$product->setTypeId(\Magento\Catalog\Model\Product\Type::TYPE_SIMPLE) |
| 92 | + ->setId(66) |
| 93 | + ->setAttributeSetId(4) |
| 94 | + ->setName('Simple Product Visible and InStock') |
| 95 | + ->setSku('simple_visible_in_stock') |
| 96 | + ->setTaxClassId('none') |
| 97 | + ->setDescription('description') |
| 98 | + ->setShortDescription('short description') |
| 99 | + ->setPrice(30) |
| 100 | + ->setWeight(1) |
| 101 | + ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_IN_CATALOG) |
| 102 | + ->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED) |
| 103 | + ->setWebsiteIds([1]) |
| 104 | + ->setCategoryIds( |
| 105 | + [300]) |
| 106 | + ->setStockData(['use_config_manage_stock' => 1, 'qty' => 140, 'is_qty_decimal' => 0, 'is_in_stock' => 1]) |
| 107 | + ->setSpecialPrice('25.99') |
| 108 | + ->save(); |
| 109 | + |
0 commit comments