Skip to content

Commit 0553cef

Browse files
author
ybohaienko
committed
Merge branch '2.1.15-develop' into MAGETWO-88668
2 parents debdd0c + 0b8b094 commit 0553cef

File tree

59 files changed

+555
-103
lines changed

Some content is hidden

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

59 files changed

+555
-103
lines changed

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/*/');
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
{

app/code/Magento/Catalog/Block/Adminhtml/Form/Renderer/Fieldset/Element.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Element extends \Magento\Backend\Block\Widget\Form\Renderer\Fieldset\Eleme
2121
/**
2222
* Retrieve data object related with form
2323
*
24-
* @return \Magento\Catalog\Model\Product || \Magento\Catalog\Model\Category
24+
* @return \Magento\Catalog\Model\Product|\Magento\Catalog\Model\Category
2525
*/
2626
public function getDataObject()
2727
{

app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Grid.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,7 @@ protected function _prepareColumns()
101101
'type' => 'options',
102102
'options' => ['1' => __('Yes'), '0' => __('No')],
103103
'align' => 'center'
104-
],
105-
'is_user_defined'
104+
]
106105
);
107106

108107
$this->_eventManager->dispatch('product_attribute_grid_build', ['grid' => $this]);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function getSelectorOptions()
8181
*
8282
* @param string $labelPart
8383
* @param int $templateId
84-
* @return \Magento\Catalog\Model\ResourceModel\Product\Attribute\Collection
84+
* @return array
8585
*/
8686
public function getSuggestedAttributes($labelPart, $templateId = null)
8787
{

app/code/Magento/Catalog/Block/Adminhtml/Rss/Grid/Link.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function isRssAllowed()
6969
}
7070

7171
/**
72-
* @return string
72+
* @return array
7373
*/
7474
protected function getLinkParams()
7575
{

0 commit comments

Comments
 (0)