Skip to content

Commit 72b8b49

Browse files
author
vpaladiychuk
committed
Merge remote-tracking branch 'origin/MAGETWO-26762' into MAGETWO-34990
2 parents 2b089fd + 48d28e4 commit 72b8b49

File tree

104 files changed

+1853
-367
lines changed

Some content is hidden

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

104 files changed

+1853
-367
lines changed

.htaccess

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -170,12 +170,6 @@
170170

171171
</IfModule>
172172

173-
############################################
174-
## By default allow all access
175-
176-
Order allow,deny
177-
Allow from all
178-
179173
###########################################
180174
## Deny access to release notes to prevent disclosure of the installed Magento version
181175

.htaccess.sample

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,12 +167,6 @@
167167

168168
</IfModule>
169169

170-
############################################
171-
## By default allow all access
172-
173-
Order allow,deny
174-
Allow from all
175-
176170
###########################################
177171
## Deny access to release notes to prevent disclosure of the installed Magento version
178172

app/code/Magento/Backend/App/Action/Context.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ class Context extends \Magento\Framework\App\Action\Context
6969
* @param \Magento\Backend\Model\UrlInterface $backendUrl
7070
* @param \Magento\Framework\Data\Form\FormKey\Validator $formKeyValidator
7171
* @param \Magento\Framework\Locale\ResolverInterface $localeResolver
72-
* @param \Magento\Backend\Model\View\Result\RedirectFactory $resultRedirectFactory
7372
* @param bool $canUseBaseUrl
7473
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
7574
*/
@@ -91,7 +90,6 @@ public function __construct(
9190
\Magento\Backend\Model\UrlInterface $backendUrl,
9291
\Magento\Framework\Data\Form\FormKey\Validator $formKeyValidator,
9392
\Magento\Framework\Locale\ResolverInterface $localeResolver,
94-
\Magento\Backend\Model\View\Result\RedirectFactory $resultRedirectFactory,
9593
$canUseBaseUrl = false
9694
) {
9795
parent::__construct(

app/code/Magento/Backend/Block/Menu.php

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -210,16 +210,24 @@ protected function _renderItemCssClass($menuItem, $level)
210210
*/
211211
protected function _renderAnchor($menuItem, $level)
212212
{
213-
return '<a href="' . $menuItem->getUrl() . '" ' . $this->_renderItemAnchorTitle(
214-
$menuItem
215-
) . $this->_renderItemOnclickFunction(
216-
$menuItem
217-
) . ' class="' . $this->_renderAnchorCssClass(
218-
$menuItem,
219-
$level
220-
) . '">' . '<span>' . $this->_getAnchorLabel(
221-
$menuItem
222-
) . '</span>' . '</a>';
213+
if ($level == 1 && $menuItem->getUrl() == '#') {
214+
$output = '<strong class="submenu-group-title" role="presentation">'
215+
. '<span>' . $this->_getAnchorLabel($menuItem) . '</span>'
216+
. '</strong>';
217+
} else {
218+
$output = '<a href="' . $menuItem->getUrl() . '" ' . $this->_renderItemAnchorTitle(
219+
$menuItem
220+
) . $this->_renderItemOnclickFunction(
221+
$menuItem
222+
) . ' class="' . $this->_renderAnchorCssClass(
223+
$menuItem,
224+
$level
225+
) . '">' . '<span>' . $this->_getAnchorLabel(
226+
$menuItem
227+
) . '</span>' . '</a>';
228+
}
229+
230+
return $output;
223231
}
224232

225233
/**
@@ -397,15 +405,16 @@ protected function _columnBrake($items, $limit)
397405
* @param \Magento\Backend\Model\Menu\Item $menuItem
398406
* @param int $level
399407
* @param int $limit
408+
* @param $id int
400409
* @return string HTML code
401410
*/
402-
protected function _addSubMenu($menuItem, $level, $limit)
411+
protected function _addSubMenu($menuItem, $level, $limit, $id = null)
403412
{
404413
$output = '';
405414
if (!$menuItem->hasChildren()) {
406415
return $output;
407416
}
408-
$output .= '<div class="submenu">';
417+
$output .= '<div class="submenu"' . ($level == 0 && isset($id) ? ' aria-labelledby="' . $id . '"' : '') . '>';
409418
$colStops = null;
410419
if ($level == 0 && $limit) {
411420
$colStops = $this->_columnBrake($menuItem->getChildren(), $limit);
@@ -426,6 +435,7 @@ protected function _addSubMenu($menuItem, $level, $limit)
426435
* @param int $limit
427436
* @param array $colBrakes
428437
* @return string HTML
438+
* @SuppressWarnings(PHPMD.NPathComplexity)
429439
*/
430440
public function renderNavigation($menu, $level = 0, $limit = 0, $colBrakes = [])
431441
{
@@ -443,18 +453,21 @@ public function renderNavigation($menu, $level = 0, $limit = 0, $colBrakes = [])
443453
$output .= '</ul></li><li class="column"><ul role="menu">';
444454
}
445455

456+
$id = $this->getJsId($menuItem->getId());
446457
$output .= '<li ' . $this->getUiId(
447458
$menuItem->getId()
448459
) . ' class="item-' . $itemClass . ' ' . $this->_renderItemCssClass(
449460
$menuItem,
450461
$level
451-
) . '" role="menu-item">' . $this->_renderAnchor(
462+
) . ($level == 0 ? '" id="' . $id . '" aria-haspopup="true' : '')
463+
. '" role="menu-item">' . $this->_renderAnchor(
452464
$menuItem,
453465
$level
454466
) . $this->_addSubMenu(
455467
$menuItem,
456468
$level,
457-
$limit
469+
$limit,
470+
$id
458471
) . '</li>';
459472
$itemPosition++;
460473
}

app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Inventory.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*/
66
namespace Magento\Catalog\Block\Adminhtml\Product\Edit\Tab;
77

8+
use Magento\Framework\Api\SimpleDataObjectConverter;
9+
810
/**
911
* Product inventory data
1012
*/
@@ -133,7 +135,7 @@ public function getFieldValue($field)
133135
{
134136
$stockItem = $this->getStockItem();
135137
if ($stockItem->getItemId()) {
136-
$method = 'get' . \Magento\Framework\Api\SimpleDataObjectConverter::snakeCaseToUpperCamelCase($field);
138+
$method = 'get' . SimpleDataObjectConverter::snakeCaseToUpperCamelCase($field);
137139
if (method_exists($stockItem, $method)) {
138140
return $stockItem->{$method}();
139141
}
@@ -149,7 +151,7 @@ public function getConfigFieldValue($field)
149151
{
150152
$stockItem = $this->getStockItem();
151153
if ($stockItem->getItemId()) {
152-
$method = 'getUseConfig' . \Magento\Framework\Api\SimpleDataObjectConverter::snakeCaseToUpperCamelCase(
154+
$method = 'getUseConfig' . SimpleDataObjectConverter::snakeCaseToUpperCamelCase(
153155
$field
154156
);
155157
if (method_exists($stockItem, $method)) {

app/code/Magento/Catalog/Controller/Adminhtml/Product/Gallery/Upload.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,20 @@
1111
class Upload extends \Magento\Backend\App\Action
1212
{
1313
/**
14-
* @var \Magento\Framework\Controller\Result\JsonFactory
14+
* @var \Magento\Framework\Controller\Result\RawFactory
1515
*/
16-
protected $resultJsonFactory;
16+
protected $resultRawFactory;
1717

1818
/**
1919
* @param \Magento\Backend\App\Action\Context $context
20-
* @param \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory
20+
* @param \Magento\Framework\Controller\Result\RawFactory $resultRawFactory
2121
*/
2222
public function __construct(
2323
\Magento\Backend\App\Action\Context $context,
24-
\Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory
24+
\Magento\Framework\Controller\Result\RawFactory $resultRawFactory
2525
) {
2626
parent::__construct($context);
27-
$this->resultJsonFactory = $resultJsonFactory;
27+
$this->resultRawFactory = $resultRawFactory;
2828
}
2929

3030
/**
@@ -36,7 +36,7 @@ protected function _isAllowed()
3636
}
3737

3838
/**
39-
* @return \Magento\Framework\Controller\Result\Json
39+
* @return \Magento\Framework\Controller\Result\Raw
4040
*/
4141
public function execute()
4242
{
@@ -72,6 +72,10 @@ public function execute()
7272
$result = ['error' => $e->getMessage(), 'errorcode' => $e->getCode()];
7373
}
7474

75-
return $this->resultJsonFactory->create()->setData($result);
75+
/** @var \Magento\Framework\Controller\Result\Raw $response */
76+
$response = $this->resultRawFactory->create();
77+
$response->setHeader('Content-type', 'text/plain');
78+
$response->setContents(json_encode($result));
79+
return $response;
7680
}
7781
}

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

100755100644
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public function execute()
9090
if ($storeId) {
9191
$product->setStoreId($storeId);
9292
}
93-
$setId = $this->getRequest()->getPost('set');
93+
$setId = $this->getRequest()->getPost('set') ?: $this->getRequest()->getParam('set');
9494
if ($setId) {
9595
$product->setAttributeSetId($setId);
9696
}

app/code/Magento/Catalog/Controller/Index/Index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<?php
22
/**
3-
*
43
* Copyright © 2015 Magento. All rights reserved.
54
* See COPYING.txt for license details.
65
*/
76
namespace Magento\Catalog\Controller\Index;
87

98
use Magento\Framework\App\Action\Context;
9+
1010
class Index extends \Magento\Framework\App\Action\Action
1111
{
1212
/**

app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Product/Action/Attribute/SaveTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,9 @@ protected function prepareContext()
216216
$this->context->expects($this->any())->method('getFormKeyValidator')->willReturn($this->formKeyValidator);
217217
$this->context->expects($this->any())->method('getTitle')->willReturn($this->title);
218218
$this->context->expects($this->any())->method('getLocaleResolver')->willReturn($this->localeResolver);
219-
$this->context->expects($this->any())->method('getResultRedirectFactory')->willReturn($this->resultRedirectFactory);
219+
$this->context->expects($this->any())
220+
->method('getResultRedirectFactory')
221+
->willReturn($this->resultRedirectFactory);
220222

221223
$this->product = $this->getMock(
222224
'Magento\Catalog\Model\Product',

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

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ class ValidateTest extends \Magento\Catalog\Test\Unit\Controller\Adminhtml\Produ
2828
protected $initializationHelper;
2929
/** @var \Magento\Catalog\Model\ProductFactory|\PHPUnit_Framework_MockObject_MockObject */
3030
protected $productFactory;
31-
/** @var \Magento\Framework\Controller\Result\JSON|\PHPUnit_Framework_MockObject_MockObject */
31+
/** @var \Magento\Framework\Controller\Result\Json|\PHPUnit_Framework_MockObject_MockObject */
3232
protected $resultJson;
33-
/** @var \Magento\Framework\Controller\Result\JSONFactory|\PHPUnit_Framework_MockObject_MockObject */
33+
/** @var \Magento\Framework\Controller\Result\JsonFactory|\PHPUnit_Framework_MockObject_MockObject */
3434
protected $resultJsonFactory;
3535

3636
protected function setUp()
@@ -104,8 +104,8 @@ protected function setUp()
104104
->getMock();
105105
$this->productFactory->expects($this->any())->method('create')->willReturn($this->product);
106106

107-
$this->resultJson = $this->getMock('Magento\Framework\Controller\Result\JSON', [], [], '', false);
108-
$this->resultJsonFactory = $this->getMockBuilder('Magento\Framework\Controller\Result\JSONFactory')
107+
$this->resultJson = $this->getMock('Magento\Framework\Controller\Result\Json', [], [], '', false);
108+
$this->resultJsonFactory = $this->getMockBuilder('Magento\Framework\Controller\Result\JsonFactory')
109109
->disableOriginalConstructor()
110110
->setMethods(['create'])
111111
->getMock();
@@ -125,15 +125,21 @@ protected function setUp()
125125
);
126126
}
127127

128-
/**
129-
* @return void
130-
*/
131-
public function testAttributeSetIsObtainedFromPost()
128+
public function testAttributeSetIsObtainedFromPostByDefault()
132129
{
130+
$this->request->expects($this->any())->method('getParam')->willReturnMap([['set', null, 4]]);
133131
$this->request->expects($this->any())->method('getPost')->willReturnMap([['set', null, 9]]);
134-
135132
$this->product->expects($this->once())->method('setAttributeSetId')->with(9);
136133

137134
$this->action->execute();
138135
}
136+
137+
public function testAttributeSetIsObtainedFromGetWhenThereIsNoOneInPost()
138+
{
139+
$this->request->expects($this->any())->method('getParam')->willReturnMap([['set', null, 4]]);
140+
$this->request->expects($this->any())->method('getPost')->willReturnMap([['set', null, null]]);
141+
$this->product->expects($this->once())->method('setAttributeSetId')->with(4);
142+
143+
$this->action->execute();
144+
}
139145
}

0 commit comments

Comments
 (0)