Skip to content

Commit 1819964

Browse files
author
olysenko
committed
Merge remote-tracking branch 'origin/develop' into MAGETWO-63716
2 parents 7689c8a + 7647dce commit 1819964

File tree

23 files changed

+550
-24
lines changed

23 files changed

+550
-24
lines changed

app/code/Magento/Authorizenet/Controller/Directpost/Payment.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ protected function _responseAction($area = 'frontend')
7373
$helper = $this->dataFactory->create($area);
7474

7575
$params = [];
76-
$data = $this->getRequest()->getPostValue();
76+
$data = $this->getRequest()->getParams();
77+
7778
/* @var $paymentMethod \Magento\Authorizenet\Model\DirectPost */
7879
$paymentMethod = $this->_objectManager->create(\Magento\Authorizenet\Model\Directpost::class);
7980

@@ -110,9 +111,8 @@ protected function _responseAction($area = 'frontend')
110111
$params['redirect'] = $helper->getRedirectIframeUrl($result);
111112
}
112113

114+
//registering parameter for iframe content
113115
$this->_coreRegistry->register(Iframe::REGISTRY_KEY, $params);
114-
$this->_view->addPageLayoutHandles();
115-
$this->_view->loadLayout(false)->renderLayout();
116116
}
117117

118118
/**

app/code/Magento/Authorizenet/Controller/Directpost/Payment/BackendResponse.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ class BackendResponse extends \Magento\Authorizenet\Controller\Directpost\Paymen
1212
* Response action.
1313
* Action for Authorize.net SIM Relay Request.
1414
*
15-
* @return void
15+
* @return \Magento\Framework\Controller\ResultInterface
1616
*/
1717
public function execute()
1818
{
1919
$this->_responseAction('adminhtml');
20+
return $this->resultFactory->create(\Magento\Framework\Controller\ResultFactory::TYPE_PAGE);
2021
}
2122
}

app/code/Magento/Authorizenet/Controller/Directpost/Payment/Response.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ class Response extends \Magento\Authorizenet\Controller\Directpost\Payment
1212
* Response action.
1313
* Action for Authorize.net SIM Relay Request.
1414
*
15-
* @return void
15+
* @return \Magento\Framework\Controller\ResultInterface
1616
*/
1717
public function execute()
1818
{
1919
$this->_responseAction('frontend');
20+
return $this->resultFactory->create(\Magento\Framework\Controller\ResultFactory::TYPE_PAGE);
2021
}
2122
}

app/code/Magento/Checkout/Block/Onepage/Success.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,4 +122,12 @@ protected function canViewOrder(Order $order)
122122
return $this->httpContext->getValue(Context::CONTEXT_AUTH)
123123
&& $this->isVisible($order);
124124
}
125+
126+
/**
127+
* @return string
128+
*/
129+
public function getContinueUrl()
130+
{
131+
return $this->_storeManager->getStore()->getBaseUrl();
132+
}
125133
}

app/code/Magento/Checkout/Test/Unit/Block/Onepage/SuccessTest.php

Lines changed: 62 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
/**
1111
* Class SuccessTest
1212
* @package Magento\Checkout\Block\Onepage
13+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1314
*/
1415
class SuccessTest extends \PHPUnit_Framework_TestCase
1516
{
@@ -18,6 +19,11 @@ class SuccessTest extends \PHPUnit_Framework_TestCase
1819
*/
1920
protected $block;
2021

22+
/**
23+
* @var \PHPUnit_Framework_MockObject_MockObject
24+
*/
25+
protected $layout;
26+
2127
/**
2228
* @var \Magento\Sales\Model\Order\Config | \PHPUnit_Framework_MockObject_MockObject
2329
*/
@@ -28,21 +34,65 @@ class SuccessTest extends \PHPUnit_Framework_TestCase
2834
*/
2935
protected $checkoutSession;
3036

37+
/**
38+
* @var \PHPUnit_Framework_MockObject_MockObject
39+
*/
40+
protected $storeManagerMock;
41+
3142
protected function setUp()
3243
{
3344
$objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
3445

3546
$this->orderConfig = $this->getMock(\Magento\Sales\Model\Order\Config::class, [], [], '', false);
47+
$this->storeManagerMock = $this->getMock(\Magento\Store\Model\StoreManagerInterface::class, [], [], '', false);
48+
49+
$this->layout = $this->getMockBuilder(\Magento\Framework\View\LayoutInterface::class)
50+
->disableOriginalConstructor()
51+
->setMethods([])
52+
->getMock();
53+
54+
$this->checkoutSession = $this->getMockBuilder(\Magento\Checkout\Model\Session::class)
55+
->disableOriginalConstructor()
56+
->getMock();
3657

37-
$this->checkoutSession = $this->getMockBuilder(
38-
\Magento\Checkout\Model\Session::class
39-
)
58+
$eventManager = $this->getMockBuilder(\Magento\Framework\Event\ManagerInterface::class)
4059
->disableOriginalConstructor()
60+
->setMethods([])
4161
->getMock();
4262

63+
$urlBuilder = $this->getMockBuilder(\Magento\Framework\UrlInterface::class)
64+
->disableOriginalConstructor()
65+
->setMethods([])
66+
->getMock();
67+
68+
$scopeConfig = $this->getMockBuilder(\Magento\Framework\App\Config\ScopeConfigInterface::class)
69+
->disableOriginalConstructor()
70+
->setMethods([])
71+
->getMock();
72+
$scopeConfig->expects($this->any())
73+
->method('getValue')
74+
->with(
75+
$this->stringContains(
76+
'advanced/modules_disable_output/'
77+
),
78+
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
79+
)
80+
->will($this->returnValue(false));
81+
82+
$context = $this->getMockBuilder(\Magento\Framework\View\Element\Template\Context::class)
83+
->disableOriginalConstructor()
84+
->setMethods(['getLayout', 'getEventManager', 'getUrlBuilder', 'getScopeConfig', 'getStoreManager'])
85+
->getMock();
86+
$context->expects($this->any())->method('getLayout')->will($this->returnValue($this->layout));
87+
$context->expects($this->any())->method('getEventManager')->will($this->returnValue($eventManager));
88+
$context->expects($this->any())->method('getUrlBuilder')->will($this->returnValue($urlBuilder));
89+
$context->expects($this->any())->method('getScopeConfig')->will($this->returnValue($scopeConfig));
90+
$context->expects($this->any())->method('getStoreManager')->will($this->returnValue($this->storeManagerMock));
91+
4392
$this->block = $objectManager->getObject(
4493
\Magento\Checkout\Block\Onepage\Success::class,
4594
[
95+
'context' => $context,
4696
'orderConfig' => $this->orderConfig,
4797
'checkoutSession' => $this->checkoutSession
4898
]
@@ -110,4 +160,13 @@ public function invisibleStatusesProvider()
110160
[['status1', 'status2'], true]
111161
];
112162
}
163+
164+
public function testGetContinueUrl()
165+
{
166+
$storeMock = $this->getMock(\Magento\Store\Model\Store::class, [], [], '', false);
167+
$this->storeManagerMock->expects($this->once())->method('getStore')->will($this->returnValue($storeMock));
168+
$storeMock->expects($this->once())->method('getBaseUrl')->will($this->returnValue('Expected Result'));
169+
170+
$this->assertEquals('Expected Result', $this->block->getContinueUrl());
171+
}
113172
}

app/code/Magento/Checkout/view/frontend/templates/success.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
<div class="actions-toolbar">
2424
<div class="primary">
25-
<a class="action primary continue" href="<?php /* @escapeNotVerified */ echo $block->getUrl() ?>"><span><?php /* @escapeNotVerified */ echo __('Continue Shopping') ?></span></a>
25+
<a class="action primary continue" href="<?php /* @escapeNotVerified */ echo $block->getContinueUrl() ?>"><span><?php /* @escapeNotVerified */ echo __('Continue Shopping') ?></span></a>
2626
</div>
2727
</div>
2828
</div>

app/code/Magento/Config/Block/System/Config/Form/Field/FieldArray/AbstractFieldArray.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,4 +279,12 @@ public function getColumns()
279279
{
280280
return $this->_columns;
281281
}
282+
283+
/**
284+
* @return string
285+
*/
286+
public function getAddButtonLabel()
287+
{
288+
return $this->_addButtonLabel;
289+
}
282290
}

app/code/Magento/Config/Test/Unit/Block/System/Config/Form/Field/FieldArray/AbstractTest.php

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,14 @@
77

88
class AbstractTest extends \PHPUnit_Framework_TestCase
99
{
10-
public function testGetArrayRows()
10+
/**
11+
* @var \Magento\Config\Block\System\Config\Form\Field\FieldArray\AbstractFieldArray
12+
*/
13+
private $model;
14+
15+
protected function setUp()
1116
{
12-
/** @var $block \Magento\Config\Block\System\Config\Form\Field\FieldArray\AbstractFieldArray */
13-
$block = $this->getMockForAbstractClass(
17+
$this->model = $this->getMockForAbstractClass(
1418
\Magento\Config\Block\System\Config\Form\Field\FieldArray\AbstractFieldArray::class,
1519
[],
1620
'',
@@ -19,12 +23,15 @@ public function testGetArrayRows()
1923
true,
2024
['escapeHtml']
2125
);
22-
$block->expects($this->any())->method('escapeHtml')->will($this->returnArgument(0));
26+
}
2327

28+
public function testGetArrayRows()
29+
{
30+
$this->model->expects($this->any())->method('escapeHtml')->will($this->returnArgument(0));
2431
$objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
2532
$element = $objectManager->getObject(\Magento\Framework\Data\Form\Element\Multiselect::class);
2633
$element->setValue([['te<s>t' => 't<e>st', 'data&1' => 'da&ta1']]);
27-
$block->setElement($element);
34+
$this->model->setElement($element);
2835
$this->assertEquals(
2936
[
3037
new \Magento\Framework\DataObject(
@@ -36,7 +43,17 @@ public function testGetArrayRows()
3643
]
3744
),
3845
],
39-
$block->getArrayRows()
46+
$this->model->getArrayRows()
4047
);
4148
}
49+
50+
public function testGetAddButtonLabel()
51+
{
52+
$contextMock = $this->getMockBuilder(\Magento\Backend\Block\Template\Context::class)
53+
->disableOriginalConstructor()
54+
->getMock();
55+
$this->model->__construct($contextMock);
56+
57+
$this->assertEquals("Add", $this->model->getAddButtonLabel());
58+
}
4259
}

app/code/Magento/Config/view/adminhtml/templates/system/config/form/field/array.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ $_colspan = $block->isAddAfter() ? 2 : 1;
2828
<tr>
2929
<td colspan="<?php echo count($block->getColumns())+$_colspan; ?>" class="col-actions-add">
3030
<button id="addToEndBtn<?php /* @escapeNotVerified */ echo $_htmlId; ?>" class="action-add" title="<?php /* @escapeNotVerified */ echo __('Add'); ?>" type="button">
31-
<span><?php /* @escapeNotVerified */ echo $block->getAddButtonLabel(); ?><?php /* @escapeNotVerified */ echo __('Add'); ?></span>
31+
<span><?php /* @escapeNotVerified */ echo $block->getAddButtonLabel(); ?></span>
3232
</button>
3333
</td>
3434
</tr>

app/code/Magento/Email/Model/AbstractTemplate.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ public function getProcessedTemplate(array $variables = [])
352352
$result = $processor->filter($this->getTemplateText());
353353
} catch (\Exception $e) {
354354
$this->cancelDesignConfig();
355-
throw new \LogicException(__($e->getMessage()), $e);
355+
throw new \LogicException(__($e->getMessage()), $e->getCode(), $e);
356356
}
357357
if ($isDesignApplied) {
358358
$this->cancelDesignConfig();

app/code/Magento/Email/Test/Unit/Model/AbstractTemplateTest.php

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,67 @@ public function testGetProcessedTemplate($variables, $templateType, $storeId, $e
241241
$this->assertEquals($expectedResult, $model->getProcessedTemplate($variables));
242242
}
243243

244+
/**
245+
* @expectedException \LogicException
246+
*/
247+
public function testGetProcessedTemplateException() {
248+
$filterTemplate = $this->getMockBuilder(\Magento\Email\Model\Template\Filter::class)
249+
->setMethods([
250+
'setUseSessionInUrl',
251+
'setPlainTemplateMode',
252+
'setIsChildTemplate',
253+
'setDesignParams',
254+
'setVariables',
255+
'setStoreId',
256+
'filter',
257+
'getStoreId',
258+
'getInlineCssFiles',
259+
])
260+
->disableOriginalConstructor()
261+
->getMock();
262+
$filterTemplate->expects($this->once())
263+
->method('setUseSessionInUrl')
264+
->will($this->returnSelf());
265+
$filterTemplate->expects($this->once())
266+
->method('setPlainTemplateMode')
267+
->will($this->returnSelf());
268+
$filterTemplate->expects($this->once())
269+
->method('setIsChildTemplate')
270+
->will($this->returnSelf());
271+
$filterTemplate->expects($this->once())
272+
->method('setDesignParams')
273+
->will($this->returnSelf());
274+
$filterTemplate->expects($this->any())
275+
->method('setStoreId')
276+
->will($this->returnSelf());
277+
$filterTemplate->expects($this->any())
278+
->method('getStoreId')
279+
->will($this->returnValue(1));
280+
281+
$model = $this->getModelMock([
282+
'getDesignParams',
283+
'applyDesignConfig',
284+
'getTemplateText',
285+
'isPlain',
286+
]);
287+
288+
$designParams = [
289+
'area' => \Magento\Framework\App\Area::AREA_FRONTEND,
290+
'theme' => 'themeId',
291+
'locale' => 'localeId',
292+
];
293+
$model->expects($this->any())
294+
->method('getDesignParams')
295+
->will($this->returnValue($designParams));
296+
$model->setTemplateFilter($filterTemplate);
297+
$model->setTemplateType(\Magento\Framework\App\TemplateTypesInterface::TYPE_TEXT);
298+
299+
$filterTemplate->expects($this->once())
300+
->method('filter')
301+
->will($this->throwException(new \Exception));
302+
$model->getProcessedTemplate([]);
303+
}
304+
244305
/**
245306
* @return array
246307
*/

app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_grid.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
<item name="component" xsi:type="string">Magento_Ui/js/grid/columns/date</item>
187187
<item name="dataType" xsi:type="string">date</item>
188188
<item name="label" xsi:type="string" translate="true">Purchase Date</item>
189-
<item name="dateFormat" xsi:type="string">MMM dd, YYYY, H:MM:SS A</item>
189+
<item name="dateFormat" xsi:type="string">MMM dd, YYYY, H:mm:ss A</item>
190190
</item>
191191
</argument>
192192
</column>

app/code/Magento/Search/view/frontend/web/form-mini.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ define([
8686
setTimeout($.proxy(function () {
8787
if (this.autoComplete.is(':hidden')) {
8888
this.setActiveState(false);
89+
} else {
90+
this.element.trigger('focus');
8991
}
9092
this.autoComplete.hide();
9193
this._updateAriaHasPopup(false);

dev/tests/functional/tests/app/Magento/Authorizenet/Test/Repository/ConfigData.xml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,5 +71,37 @@
7171
<item name="value" xsi:type="number">0</item>
7272
</field>
7373
</dataset>
74+
<dataset name="authorizenet_authorize">
75+
<field name="payment/authorizenet_directpost/payment_action" xsi:type="array">
76+
<item name="scope" xsi:type="string">payment</item>
77+
<item name="scope_id" xsi:type="number">1</item>
78+
<item name="label" xsi:type="string"/>
79+
<item name="value" xsi:type="string">authorize_capture</item>
80+
</field>
81+
</dataset>
82+
<dataset name="authorizenet_authorize_rollback">
83+
<field name="payment/authorizenet_directpost/payment_action" xsi:type="array">
84+
<item name="scope" xsi:type="string">payment</item>
85+
<item name="scope_id" xsi:type="number">1</item>
86+
<item name="label" xsi:type="string"/>
87+
<item name="value" xsi:type="string">authorize</item>
88+
</field>
89+
</dataset>
90+
<dataset name="authorizenet_authorize_capture">
91+
<field name="payment/authorizenet_directpost/payment_action" xsi:type="array">
92+
<item name="scope" xsi:type="string">payment</item>
93+
<item name="scope_id" xsi:type="number">1</item>
94+
<item name="label" xsi:type="string"/>
95+
<item name="value" xsi:type="string">authorize_capture</item>
96+
</field>
97+
</dataset>
98+
<dataset name="authorizenet_authorize_capture_rollback">
99+
<field name="payment/authorizenet_directpost/payment_action" xsi:type="array">
100+
<item name="scope" xsi:type="string">payment</item>
101+
<item name="scope_id" xsi:type="number">1</item>
102+
<item name="label" xsi:type="string"/>
103+
<item name="value" xsi:type="string">authorize</item>
104+
</field>
105+
</dataset>
74106
</repository>
75107
</config>

0 commit comments

Comments
 (0)