Skip to content

Commit 0727647

Browse files
committed
MAGETWO-50681: Merge mainline develop branch and stabilize bamboo builds
1 parent a0145b9 commit 0727647

File tree

3 files changed

+166
-6
lines changed

3 files changed

+166
-6
lines changed

dev/tests/integration/testsuite/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/EavTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
namespace Magento\Catalog\Ui\DataProvider\Product\Form\Modifier;
77

88
/**
9+
* @magentoDbIsolation enabled
10+
* @magentoAppIsolation enabled
911
* @magentoAppArea adminhtml
1012
*/
1113
class EavTest extends \PHPUnit_Framework_TestCase
@@ -68,7 +70,7 @@ public function testModifyMeta()
6870
}
6971

7072
/**
71-
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
73+
* @magentoDataFixture Magento/Catalog/_files/product_simple_with_admin_store.php
7274
*/
7375
public function testModifyData()
7476
{

dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,6 @@
99
/** @var \Magento\TestFramework\ObjectManager $objectManager */
1010
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
1111

12-
/** @var \Magento\Store\Model\StoreManagerInterface $storeManager */
13-
$storeManager = $objectManager->get('Magento\Store\Model\StoreManagerInterface');
14-
$store = $storeManager->getStore(\Magento\Store\Model\Store::ADMIN_CODE);
15-
$storeManager->setCurrentStore($store->getCode());
16-
1712
/** @var \Magento\Catalog\Api\CategoryLinkManagementInterface $categoryLinkManagement */
1813
$categoryLinkManagement = $objectManager->create('Magento\Catalog\Api\CategoryLinkManagementInterface');
1914

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
\Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize();
8+
9+
/** @var \Magento\TestFramework\ObjectManager $objectManager */
10+
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
11+
12+
/** @var \Magento\Store\Model\StoreManagerInterface $storeManager */
13+
$storeManager = $objectManager->get('Magento\Store\Model\StoreManagerInterface');
14+
$store = $storeManager->getStore(\Magento\Store\Model\Store::ADMIN_CODE);
15+
$storeManager->setCurrentStore($store->getCode());
16+
17+
/** @var \Magento\Catalog\Api\CategoryLinkManagementInterface $categoryLinkManagement */
18+
$categoryLinkManagement = $objectManager->create('Magento\Catalog\Api\CategoryLinkManagementInterface');
19+
20+
/** @var $product \Magento\Catalog\Model\Product */
21+
$product = $objectManager->create('Magento\Catalog\Model\Product');
22+
$product->isObjectNew(true);
23+
$product->setTypeId(\Magento\Catalog\Model\Product\Type::TYPE_SIMPLE)
24+
->setId(1)
25+
->setAttributeSetId(4)
26+
->setWebsiteIds([1])
27+
->setName('Simple Product')
28+
->setSku('simple')
29+
->setPrice(10)
30+
->setWeight(1)
31+
->setShortDescription("Short description")
32+
->setTaxClassId(0)
33+
->setTierPrice(
34+
[
35+
[
36+
'website_id' => 0,
37+
'cust_group' => \Magento\Customer\Model\Group::CUST_GROUP_ALL,
38+
'price_qty' => 2,
39+
'price' => 8,
40+
],
41+
[
42+
'website_id' => 0,
43+
'cust_group' => \Magento\Customer\Model\Group::CUST_GROUP_ALL,
44+
'price_qty' => 5,
45+
'price' => 5,
46+
],
47+
[
48+
'website_id' => 0,
49+
'cust_group' => \Magento\Customer\Model\Group::NOT_LOGGED_IN_ID,
50+
'price_qty' => 3,
51+
'price' => 5,
52+
],
53+
]
54+
)
55+
->setDescription('Description with <b>html tag</b>')
56+
->setMetaTitle('meta title')
57+
->setMetaKeyword('meta keyword')
58+
->setMetaDescription('meta description')
59+
->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH)
60+
->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED)
61+
->setStockData(
62+
[
63+
'use_config_manage_stock' => 1,
64+
'qty' => 100,
65+
'is_qty_decimal' => 0,
66+
'is_in_stock' => 1,
67+
]
68+
)->setCanSaveCustomOptions(true)
69+
->setHasOptions(true);
70+
71+
$oldOptions = [
72+
[
73+
'previous_group' => 'text',
74+
'title' => 'Test Field',
75+
'type' => 'field',
76+
'is_require' => 1,
77+
'sort_order' => 0,
78+
'price' => 1,
79+
'price_type' => 'fixed',
80+
'sku' => '1-text',
81+
'max_characters' => 100,
82+
],
83+
[
84+
'previous_group' => 'date',
85+
'title' => 'Test Date and Time',
86+
'type' => 'date_time',
87+
'is_require' => 1,
88+
'sort_order' => 0,
89+
'price' => 2,
90+
'price_type' => 'fixed',
91+
'sku' => '2-date',
92+
],
93+
[
94+
'previous_group' => 'select',
95+
'title' => 'Test Select',
96+
'type' => 'drop_down',
97+
'is_require' => 1,
98+
'sort_order' => 0,
99+
'values' => [
100+
[
101+
'option_type_id' => -1,
102+
'title' => 'Option 1',
103+
'price' => 3,
104+
'price_type' => 'fixed',
105+
'sku' => '3-1-select',
106+
],
107+
[
108+
'option_type_id' => -1,
109+
'title' => 'Option 2',
110+
'price' => 3,
111+
'price_type' => 'fixed',
112+
'sku' => '3-2-select',
113+
],
114+
]
115+
],
116+
[
117+
'previous_group' => 'select',
118+
'title' => 'Test Radio',
119+
'type' => 'radio',
120+
'is_require' => 1,
121+
'sort_order' => 0,
122+
'values' => [
123+
[
124+
'option_type_id' => -1,
125+
'title' => 'Option 1',
126+
'price' => 3,
127+
'price_type' => 'fixed',
128+
'sku' => '4-1-radio',
129+
],
130+
[
131+
'option_type_id' => -1,
132+
'title' => 'Option 2',
133+
'price' => 3,
134+
'price_type' => 'fixed',
135+
'sku' => '4-2-radio',
136+
],
137+
]
138+
]
139+
];
140+
141+
$options = [];
142+
143+
/** @var \Magento\Catalog\Api\Data\ProductCustomOptionInterfaceFactory $customOptionFactory */
144+
$customOptionFactory = $objectManager->create('Magento\Catalog\Api\Data\ProductCustomOptionInterfaceFactory');
145+
146+
foreach ($oldOptions as $option) {
147+
/** @var \Magento\Catalog\Api\Data\ProductCustomOptionInterface $option */
148+
$option = $customOptionFactory->create(['data' => $option]);
149+
$option->setProductSku($product->getSku());
150+
151+
$options[] = $option;
152+
}
153+
154+
$product->setOptions($options);
155+
156+
/** @var \Magento\Catalog\Api\ProductRepositoryInterface $productRepositoryFactory */
157+
$productRepositoryFactory = $objectManager->create('Magento\Catalog\Api\ProductRepositoryInterface');
158+
$productRepositoryFactory->save($product);
159+
160+
$categoryLinkManagement->assignProductToCategories(
161+
$product->getSku(),
162+
[2]
163+
);

0 commit comments

Comments
 (0)