Skip to content

Commit d4abdf5

Browse files
author
ybohaienko
committed
Merge branch '2.1.15-develop' into MAGETWO-83492
2 parents 6200412 + 0b8b094 commit d4abdf5

File tree

85 files changed

+601
-133
lines changed

Some content is hidden

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

85 files changed

+601
-133
lines changed

app/code/Magento/Backend/App/AbstractAction.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ public function dispatch(\Magento\Framework\App\RequestInterface $request)
214214
$this->_view->loadLayout(['default', 'adminhtml_denied'], true, true, false);
215215
$this->_view->renderLayout();
216216
$this->_request->setDispatched(true);
217+
217218
return $this->_response;
218219
}
219220

@@ -223,6 +224,11 @@ public function dispatch(\Magento\Framework\App\RequestInterface $request)
223224

224225
$this->_processLocaleSettings();
225226

227+
// Need to preload isFirstPageAfterLogin (see https://github.com/magento/magento2/issues/15510)
228+
if ($this->_auth->isLoggedIn()) {
229+
$this->_auth->getAuthStorage()->isFirstPageAfterLogin();
230+
}
231+
226232
return parent::dispatch($request);
227233
}
228234

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,12 @@ protected function _renderItemCssClass($menuItem, $level)
211211
protected function _renderAnchor($menuItem, $level)
212212
{
213213
if ($level == 1 && $menuItem->getUrl() == '#') {
214-
$output = '<strong class="submenu-group-title" role="presentation">'
215-
. '<span>' . $this->_getAnchorLabel($menuItem) . '</span>'
216-
. '</strong>';
214+
$output = '';
215+
if ($menuItem->hasChildren()) {
216+
$output = '<strong class="submenu-group-title" role="presentation">'
217+
. '<span>' . $this->_getAnchorLabel($menuItem) . '</span>'
218+
. '</strong>';
219+
}
217220
} else {
218221
$output = '<a href="' . $menuItem->getUrl() . '" ' . $this->_renderItemAnchorTitle(
219222
$menuItem

app/code/Magento/Backend/Controller/Adminhtml/System/Store/DeleteGroupPost.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,28 @@
77
namespace Magento\Backend\Controller\Adminhtml\System\Store;
88

99
use Magento\Framework\Controller\ResultFactory;
10+
use Magento\Framework\App\Request\Http as HttpRequest;
11+
use Magento\Framework\Exception\NotFoundException;
1012

1113
class DeleteGroupPost extends \Magento\Backend\Controller\Adminhtml\System\Store
1214
{
1315
/**
1416
* @return \Magento\Backend\Model\View\Result\Redirect
17+
* @throws NotFoundException
1518
*/
1619
public function execute()
1720
{
18-
$itemId = $this->getRequest()->getParam('item_id');
19-
21+
/** @var HttpRequest $request */
22+
$request = $this->getRequest();
2023
/** @var \Magento\Backend\Model\View\Result\Redirect $redirectResult */
21-
$redirectResult = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
24+
$redirectResult = $this->resultFactory->create(
25+
ResultFactory::TYPE_REDIRECT
26+
);
27+
if (!$request->isPost()) {
28+
throw new NotFoundException(__('Page not found.'));
29+
}
2230

31+
$itemId = $request->getParam('item_id');
2332
if (!($model = $this->_objectManager->create('Magento\Store\Model\Group')->load($itemId))) {
2433
$this->messageManager->addError(__('Something went wrong. Please try again.'));
2534
return $redirectResult->setPath('adminhtml/*/');

app/code/Magento/Backend/Controller/Adminhtml/System/Store/DeleteStorePost.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,31 @@
66
*/
77
namespace Magento\Backend\Controller\Adminhtml\System\Store;
88

9+
use Magento\Framework\App\Request\Http as HttpRequest;
910
use Magento\Framework\Controller\ResultFactory;
11+
use Magento\Framework\Exception\NotFoundException;
1012

1113
class DeleteStorePost extends \Magento\Backend\Controller\Adminhtml\System\Store
1214
{
1315
/**
1416
* Delete store view post action
1517
*
1618
* @return \Magento\Backend\Model\View\Result\Redirect
19+
* @throws NotFoundException
1720
*/
1821
public function execute()
1922
{
20-
$itemId = $this->getRequest()->getParam('item_id');
21-
23+
/** @var HttpRequest $request */
24+
$request = $this->getRequest();
2225
/** @var \Magento\Backend\Model\View\Result\Redirect $redirectResult */
23-
$redirectResult = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
26+
$redirectResult = $this->resultFactory->create(
27+
ResultFactory::TYPE_REDIRECT
28+
);
29+
if (!$request->isPost()) {
30+
throw new NotFoundException(__('Page not found.'));
31+
}
32+
33+
$itemId = $request->getParam('item_id');
2434
if (!($model = $this->_objectManager->create('Magento\Store\Model\Store')->load($itemId))) {
2535
$this->messageManager->addError(__('Something went wrong. Please try again.'));
2636
return $redirectResult->setPath('adminhtml/*/');

app/code/Magento/Backend/Controller/Adminhtml/System/Store/DeleteWebsitePost.php

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,30 @@
77
namespace Magento\Backend\Controller\Adminhtml\System\Store;
88

99
use Magento\Framework\Controller\ResultFactory;
10+
use Magento\Framework\App\Request\Http as HttpRequest;
11+
use Magento\Framework\Exception\NotFoundException;
1012

1113
class DeleteWebsitePost extends \Magento\Backend\Controller\Adminhtml\System\Store
1214
{
1315
/**
1416
* @return \Magento\Backend\Model\View\Result\Redirect
17+
* @throws NotFoundException
1518
*/
1619
public function execute()
1720
{
18-
$itemId = $this->getRequest()->getParam('item_id');
19-
$model = $this->_objectManager->create('Magento\Store\Model\Website');
20-
$model->load($itemId);
21-
21+
/** @var HttpRequest $request */
22+
$request = $this->getRequest();
2223
/** @var \Magento\Backend\Model\View\Result\Redirect $redirectResult */
23-
$redirectResult = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
24+
$redirectResult = $this->resultFactory->create(
25+
ResultFactory::TYPE_REDIRECT
26+
);
27+
if (!$request->isPost()) {
28+
throw new NotFoundException(__('Page not found.'));
29+
}
2430

31+
$itemId = $request->getParam('item_id');
32+
$model = $this->_objectManager->create('Magento\Store\Model\Website');
33+
$model->load($itemId);
2534
if (!$model) {
2635
$this->messageManager->addError(__('Something went wrong. Please try again.'));
2736
return $redirectResult->setPath('adminhtml/*/');

app/code/Magento/Braintree/i18n/en_US.csv

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,4 +165,5 @@ Debug,Debug
165165
"credit_card","Credit card"
166166
"apple_pay_card","Apple pay card"
167167
"android_pay_card","Android pay card"
168-
"Accept credit/debit cards and PayPal in your Magento store.<br/>No setup or monthly fees and your customers never leave your store to complete the purchase.","Accept credit/debit cards and PayPal in your Magento store.<br/>No setup or monthly fees and your customers never leave your store to complete the purchase."
168+
"Accept credit/debit cards and PayPal in your Magento store.<br/>No setup or monthly fees and your customers never leave your store to complete the purchase.","Accept credit/debit cards and PayPal in your Magento store.<br/>No setup or monthly fees and your customers never leave your store to complete the purchase."
169+
"Save for later use.","Save for later use."

app/code/Magento/Braintree/view/adminhtml/templates/form/cc.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ $ccType = $block->getInfoData('cc_type');
8484
name="payment[is_active_payment_token_enabler]"
8585
class="admin__control-checkbox"/>
8686
<label class="label" for="<?php /* @noEscape */ echo $code; ?>_vault">
87-
<span><?php echo $block->escapeHtml('Save for later use.'); ?></span>
87+
<span><?php echo $block->escapeHtml(__('Save for later use.')); ?></span>
8888
</label>
8989
</div>
9090
<?php endif; ?>
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Captcha\Test\Unit\Observer;
8+
9+
use Magento\Captcha\Helper\Data as CaptchaDataHelper;
10+
use Magento\Captcha\Observer\CaptchaStringResolver;
11+
use Magento\Framework\App\Request\Http as HttpRequest;
12+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
13+
14+
class CaptchaStringResolverTest extends \PHPUnit_Framework_TestCase
15+
{
16+
/**
17+
* @var ObjectManager
18+
*/
19+
private $objectManagerHelper;
20+
21+
/**
22+
* @var CaptchaStringResolver
23+
*/
24+
private $captchaStringResolver;
25+
26+
/**
27+
* @var HttpRequest|\PHPUnit_Framework_MockObject_MockObject
28+
*/
29+
private $requestMock;
30+
31+
protected function setUp()
32+
{
33+
$this->objectManagerHelper = new ObjectManager($this);
34+
$this->requestMock = $this->getMock(HttpRequest::class, [], [], '', false);
35+
$this->captchaStringResolver = $this->objectManagerHelper->getObject(CaptchaStringResolver::class);
36+
}
37+
38+
public function testResolveWithFormIdSet()
39+
{
40+
$formId = 'contact_us';
41+
$captchaValue = 'some-value';
42+
43+
$this->requestMock->expects($this->once())
44+
->method('getPost')
45+
->with(CaptchaDataHelper::INPUT_NAME_FIELD_VALUE)
46+
->willReturn([$formId => $captchaValue]);
47+
48+
self::assertEquals(
49+
$this->captchaStringResolver->resolve($this->requestMock, $formId),
50+
$captchaValue
51+
);
52+
}
53+
54+
public function testResolveWithNoFormIdInRequest()
55+
{
56+
$formId = 'contact_us';
57+
58+
$this->requestMock->expects($this->once())
59+
->method('getPost')
60+
->with(CaptchaDataHelper::INPUT_NAME_FIELD_VALUE)
61+
->willReturn([]);
62+
63+
self::assertEquals(
64+
$this->captchaStringResolver->resolve($this->requestMock, $formId),
65+
''
66+
);
67+
}
68+
}

app/code/Magento/Catalog/Block/Adminhtml/Category/Tree.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ public function getBreadcrumbsJavascript($path, $javascriptVarName)
325325
*
326326
* @param Node|array $node
327327
* @param int $level
328-
* @return string
328+
* @return array
329329
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
330330
* @SuppressWarnings(PHPMD.NPathComplexity)
331331
*/

app/code/Magento/Catalog/Block/Adminhtml/Category/Widget/Chooser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ function (node, e) {
144144
*
145145
* @param \Magento\Framework\Data\Tree\Node|array $node
146146
* @param int $level
147-
* @return string
147+
* @return array
148148
*/
149149
protected function _getNodeJson($node, $level = 0)
150150
{

0 commit comments

Comments
 (0)