Skip to content

Commit dd12ccf

Browse files
author
Oleksii Korshenko
committed
Merge remote-tracking branch 'mainline/develop' into pull-request
2 parents cd09595 + 51d0453 commit dd12ccf

File tree

64 files changed

+566
-466
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+566
-466
lines changed

.htaccess.sample

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
############################################
2-
## overrides deployment configuration mode value
3-
## use command bin/magento deploy:mode:set to switch modes
4-
5-
# SetEnv MAGE_MODE developer
2+
## Optional override of deployment mode. We recommend you use the
3+
## command bin/magento deploy:mode:set to switch modes instead
4+
# SetEnv MAGE_MODE default # or production or developer
65

76
############################################
8-
## uncomment these lines for CGI mode
9-
## make sure to specify the correct cgi php binary file name
7+
## Uncomment these lines for CGI mode.
8+
## Make sure to specify the correct cgi php binary file name
109
## it might be /cgi-bin/php-cgi
1110

1211
# Action php5-cgi /cgi-bin/php5-cgi
@@ -17,42 +16,42 @@
1716

1817
# Options -MultiViews
1918

20-
## you might also need to add this line to php.ini
19+
## You might also need to add this line to php.ini
2120
## cgi.fix_pathinfo = 1
22-
## if it still doesn't work, rename php.ini to php5.ini
21+
## If it still doesn't work, rename php.ini to php5.ini
2322

2423
############################################
25-
## this line is specific for 1and1 hosting
24+
## This line is specific for 1and1 hosting
2625

2726
#AddType x-mapp-php5 .php
2827
#AddHandler x-mapp-php5 .php
2928

3029
############################################
31-
## default index file
30+
## Default index file
3231

3332
DirectoryIndex index.php
3433

3534
<IfModule mod_php5.c>
3635

3736
############################################
38-
## adjust memory limit
37+
## Adjust memory limit
3938

4039
php_value memory_limit 768M
4140
php_value max_execution_time 18000
4241

4342
############################################
44-
## disable automatic session start
43+
## Disable automatic session start
4544
## before autoload was initialized
4645

4746
php_flag session.auto_start off
4847

4948
############################################
50-
## enable resulting html compression
49+
## Enable resulting html compression
5150

5251
#php_flag zlib.output_compression on
5352

5453
###########################################
55-
## disable user agent verification to not break multiple image upload
54+
## Disable user agent verification to not break multiple image upload
5655

5756
php_flag suhosin.session.cryptua off
5857

@@ -61,32 +60,32 @@
6160
<IfModule mod_php7.c>
6261

6362
############################################
64-
## adjust memory limit
63+
## Adjust memory limit
6564

6665
php_value memory_limit 768M
6766
php_value max_execution_time 18000
6867

6968
############################################
70-
## disable automatic session start
69+
## Disable automatic session start
7170
## before autoload was initialized
7271

7372
php_flag session.auto_start off
7473

7574
############################################
76-
## enable resulting html compression
75+
## Enable resulting html compression
7776

7877
#php_flag zlib.output_compression on
7978

8079
###########################################
81-
## disable user agent verification to not break multiple image upload
80+
## Disable user agent verification to not break multiple image upload
8281

8382
php_flag suhosin.session.cryptua off
8483

8584
</IfModule>
8685

8786
<IfModule mod_security.c>
8887
###########################################
89-
## disable POST processing to not break multiple image upload
88+
## Disable POST processing to not break multiple image upload
9089

9190
SecFilterEngine Off
9291
SecFilterScanPOST Off
@@ -95,7 +94,7 @@
9594
<IfModule mod_deflate.c>
9695

9796
############################################
98-
## enable apache served files compression
97+
## Enable apache served files compression
9998
## http://developer.yahoo.com/performance/rules.html#gzip
10099

101100
# Insert filter on all content
@@ -123,14 +122,14 @@
123122
<IfModule mod_ssl.c>
124123

125124
############################################
126-
## make HTTPS env vars available for CGI mode
125+
## Make HTTPS env vars available for CGI mode
127126

128127
SSLOptions StdEnvVars
129128

130129
</IfModule>
131130

132131
############################################
133-
## workaround for Apache 2.4.6 CentOS build when working via ProxyPassMatch with HHVM (or any other)
132+
## Workaround for Apache 2.4.6 CentOS build when working via ProxyPassMatch with HHVM (or any other)
134133
## Please, set it on virtual host configuration level
135134

136135
## SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
@@ -139,19 +138,19 @@
139138
<IfModule mod_rewrite.c>
140139

141140
############################################
142-
## enable rewrites
141+
## Enable rewrites
143142

144143
Options +FollowSymLinks
145144
RewriteEngine on
146145

147146
############################################
148-
## you can put here your magento root folder
147+
## You can put here your magento root folder
149148
## path relative to web root
150149

151150
#RewriteBase /magento/
152151

153152
############################################
154-
## workaround for HTTP authorization
153+
## Workaround for HTTP authorization
155154
## in CGI environment
156155

157156
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
@@ -163,21 +162,21 @@
163162
RewriteRule .* - [L,R=405]
164163

165164
############################################
166-
## redirect for mobile user agents
165+
## Redirect for mobile user agents
167166

168167
#RewriteCond %{REQUEST_URI} !^/mobiledirectoryhere/.*$
169168
#RewriteCond %{HTTP_USER_AGENT} "android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC]
170169
#RewriteRule ^(.*)$ /mobiledirectoryhere/ [L,R=302]
171170

172171
############################################
173-
## never rewrite for existing files, directories and links
172+
## Never rewrite for existing files, directories and links
174173

175174
RewriteCond %{REQUEST_FILENAME} !-f
176175
RewriteCond %{REQUEST_FILENAME} !-d
177176
RewriteCond %{REQUEST_FILENAME} !-l
178177

179178
############################################
180-
## rewrite everything else to index.php
179+
## Rewrite everything else to index.php
181180

182181
RewriteRule .* index.php [L]
183182

app/code/Magento/Bundle/Model/LinkManagement.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ private function getOptions(\Magento\Catalog\Api\Data\ProductInterface $product)
368368
$product
369369
);
370370

371-
$options = $optionCollection->appendSelections($selectionCollection);
371+
$options = $optionCollection->appendSelections($selectionCollection, true);
372372
return $options;
373373
}
374374

app/code/Magento/Bundle/Model/Product/CopyConstructor/Bundle.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function build(Product $product, Product $duplicate)
2424
return;
2525
}
2626

27-
$bundleOptions = $product->getExtensionAttributes()->getBundleProductOptions();
27+
$bundleOptions = $product->getExtensionAttributes()->getBundleProductOptions() ?: [];
2828
$duplicatedBundleOptions = [];
2929
foreach ($bundleOptions as $key => $bundleOption) {
3030
$duplicatedBundleOptions[$key] = clone $bundleOption;

app/code/Magento/Bundle/Model/Product/Type.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,6 @@ public function getSelectionsCollection($optionIds, $product)
456456
$selectionsCollection = $this->_bundleCollection->create()
457457
->addAttributeToSelect($this->_config->getProductAttributes())
458458
->addAttributeToSelect('tax_class_id')//used for calculation item taxes in Bundle with Dynamic Price
459-
->setFlag('require_stock_items', true)
460459
->setFlag('product_children', true)
461460
->setPositionOrder()
462461
->addStoreFilter($this->getStoreFilter($product))
@@ -806,7 +805,6 @@ public function getSelectionsByIds($selectionIds, $product)
806805
$usedSelections = $this->_bundleCollection
807806
->create()
808807
->addAttributeToSelect('*')
809-
->setFlag('require_stock_items', true)
810808
->setFlag('product_children', true)
811809
->addStoreFilter($this->getStoreFilter($product))
812810
->setStoreId($storeId)

app/code/Magento/Bundle/Test/Unit/Model/LinkManagementTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1048,7 +1048,7 @@ public function getRemoveOptions()
10481048
->will($this->returnValue([]));
10491049

10501050
$this->optionCollection->expects($this->any())->method('appendSelections')
1051-
->with($this->equalTo([]))
1051+
->with($this->equalTo([]), true)
10521052
->will($this->returnValue([$this->option]));
10531053
}
10541054
}

app/code/Magento/Bundle/Test/Unit/Model/Product/CopyConstructor/BundleTest.php

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,46 @@ public function testBuildPositive()
8989

9090
$this->model->build($product, $duplicate);
9191
}
92+
93+
/**
94+
* @return void
95+
*/
96+
public function testBuildWithoutOptions()
97+
{
98+
$product = $this->getMockBuilder(Product::class)
99+
->disableOriginalConstructor()
100+
->getMock();
101+
$extensionAttributesProduct = $this->getMockBuilder(ProductExtensionInterface::class)
102+
->setMethods(['getBundleProductOptions'])
103+
->disableOriginalConstructor()
104+
->getMockForAbstractClass();
105+
106+
$product->expects($this->once())
107+
->method('getTypeId')
108+
->willReturn(Type::TYPE_BUNDLE);
109+
$product->expects($this->once())
110+
->method('getExtensionAttributes')
111+
->willReturn($extensionAttributesProduct);
112+
113+
$extensionAttributesProduct->expects($this->once())
114+
->method('getBundleProductOptions')
115+
->willReturn(null);
116+
117+
$duplicate = $this->getMockBuilder(Product::class)
118+
->disableOriginalConstructor()
119+
->getMock();
120+
$extensionAttributesDuplicate = $this->getMockBuilder(ProductExtensionInterface::class)
121+
->setMethods(['setBundleProductOptions'])
122+
->disableOriginalConstructor()
123+
->getMockForAbstractClass();
124+
125+
$duplicate->expects($this->once())
126+
->method('getExtensionAttributes')
127+
->willReturn($extensionAttributesDuplicate);
128+
$extensionAttributesDuplicate->expects($this->once())
129+
->method('setBundleProductOptions')
130+
->with([]);
131+
132+
$this->model->build($product, $duplicate);
133+
}
92134
}

app/code/Magento/Bundle/Test/Unit/Model/Product/TypeTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1956,7 +1956,6 @@ public function testGetSelectionsByIds()
19561956
->with('*')
19571957
->will($this->returnSelf());
19581958
$flagMap = [
1959-
['require_stock_items', true, $usedSelectionsMock],
19601959
['product_children', true, $usedSelectionsMock],
19611960
];
19621961
$usedSelectionsMock->expects($this->any())

app/code/Magento/Catalog/Controller/Adminhtml/Product/NewAction.php

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ class NewAction extends \Magento\Catalog\Controller\Adminhtml\Product
1414
{
1515
/**
1616
* @var Initialization\StockDataFilter
17+
* @deprecated
1718
*/
1819
protected $stockFilter;
1920

@@ -27,11 +28,6 @@ class NewAction extends \Magento\Catalog\Controller\Adminhtml\Product
2728
*/
2829
protected $resultForwardFactory;
2930

30-
/**
31-
* @var Initialization\Helper
32-
*/
33-
protected $initializationHelper;
34-
3531
/**
3632
* @param Action\Context $context
3733
* @param Builder $productBuilder
@@ -64,20 +60,6 @@ public function execute()
6460
}
6561

6662
$product = $this->productBuilder->build($this->getRequest());
67-
68-
$productData = $this->getRequest()->getPost('product');
69-
if (!$productData) {
70-
$sessionData = $this->_session->getProductData(true);
71-
if (!empty($sessionData['product'])) {
72-
$productData = $sessionData['product'];
73-
}
74-
}
75-
if ($productData) {
76-
$stockData = isset($productData['stock_data']) ? $productData['stock_data'] : [];
77-
$productData['stock_data'] = $this->stockFilter->filter($stockData);
78-
$product = $this->getInitializationHelper()->initializeFromData($product, $productData);
79-
}
80-
8163
$this->_eventManager->dispatch('catalog_product_new_action', ['product' => $product]);
8264

8365
/** @var \Magento\Backend\Model\View\Result\Page $resultPage */
@@ -98,16 +80,4 @@ public function execute()
9880

9981
return $resultPage;
10082
}
101-
102-
/**
103-
* @return Initialization\Helper
104-
* @deprecated
105-
*/
106-
protected function getInitializationHelper()
107-
{
108-
if (null === $this->initializationHelper) {
109-
$this->initializationHelper = ObjectManager::getInstance()->get(Initialization\Helper::class);
110-
}
111-
return $this->initializationHelper;
112-
}
11383
}

app/code/Magento/Catalog/Controller/Adminhtml/Product/Save.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,11 @@ public function execute()
141141
}
142142
} catch (\Magento\Framework\Exception\LocalizedException $e) {
143143
$this->messageManager->addError($e->getMessage());
144-
$this->_session->setProductData($data);
145144
$this->getDataPersistor()->set('catalog_product', $data);
146145
$redirectBack = $productId ? true : 'new';
147146
} catch (\Exception $e) {
148147
$this->_objectManager->get('Psr\Log\LoggerInterface')->critical($e);
149148
$this->messageManager->addError($e->getMessage());
150-
$this->_session->setProductData($data);
151149
$this->getDataPersistor()->set('catalog_product', $data);
152150
$redirectBack = $productId ? true : 'new';
153151
}

app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Product/NewActionTest.php

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -70,19 +70,14 @@ protected function setUp()
7070
$resultForwardFactory->expects($this->any())
7171
->method('create')
7272
->willReturn($this->resultForward);
73-
$this->initializationHelper = $this->getMock(Helper::class, [], [], '', false);
74-
$stockDataFilter = $this->getMockBuilder(StockDataFilter::class)
75-
->disableOriginalConstructor()->getMock();
7673

7774
$this->action = (new ObjectManager($this))->getObject(
7875
NewAction::class,
7976
[
8077
'context' => $this->initContext(),
8178
'productBuilder' => $this->productBuilder,
82-
'stockFilter' => $stockDataFilter,
8379
'resultPageFactory' => $resultPageFactory,
8480
'resultForwardFactory' => $resultForwardFactory,
85-
'initializationHelper' => $this->initializationHelper,
8681
]
8782
);
8883

@@ -98,23 +93,4 @@ public function testExecute()
9893
->willReturn('catalog_product_new');
9994
$this->action->execute();
10095
}
101-
102-
public function testExecuteObtainsProductDataFromSession()
103-
{
104-
$this->action->getRequest()->expects($this->any())->method('getParam')->willReturn(true);
105-
$this->action->getRequest()->expects($this->any())->method('getFullActionName')
106-
->willReturn('catalog_product_new');
107-
108-
$productData = ['name' => 'test-name', 'stock_data' => null];
109-
$this->session->expects($this->any())->method('getProductData')
110-
->willReturn(['product' => $productData]);
111-
112-
$this->initializationHelper
113-
->expects($this->once())
114-
->method('initializeFromData')
115-
->with($this->product, $productData)
116-
->willReturn($this->product);
117-
118-
$this->action->execute();
119-
}
12096
}

0 commit comments

Comments
 (0)