Skip to content

Commit 0b8b094

Browse files
author
Dmytro Voskoboinikov
committed
Merge branch '2.1-develop' into 2.1.15-develop
2 parents 7acadb5 + d2494a8 commit 0b8b094

File tree

50 files changed

+329
-69
lines changed

Some content is hidden

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

50 files changed

+329
-69
lines changed
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
{

app/code/Magento/Catalog/Block/Category/Rss/Link.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function getLabel()
6060
}
6161

6262
/**
63-
* @return string
63+
* @return array
6464
*/
6565
protected function getLinkParams()
6666
{

app/code/Magento/Catalog/Block/Product/AbstractProduct.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ public function getAddToCompareUrl()
186186
* Gets minimal sales quantity
187187
*
188188
* @param \Magento\Catalog\Model\Product $product
189-
* @return int|null
189+
* @return float|null
190190
*/
191191
public function getMinimalQty($product)
192192
{

app/code/Magento/Catalog/Block/Product/View/Options/AbstractOptions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ public function getPrice($price, $includingTax = null)
174174
* Returns price converted to current currency rate
175175
*
176176
* @param float $price
177-
* @return float
177+
* @return float|string
178178
*/
179179
public function getCurrencyPrice($price)
180180
{

0 commit comments

Comments
 (0)