Skip to content

Commit 93c54b0

Browse files
author
Ankur Kaneria
committed
Merge remote-tracking branch 'mainline/develop' into PR_Branch
2 parents fe4c8c7 + 2dff306 commit 93c54b0

File tree

31 files changed

+242
-35
lines changed

31 files changed

+242
-35
lines changed

app/code/Magento/Catalog/view/adminhtml/web/js/product-gallery.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,7 @@ define([
380380
var $checkbox = $(event.currentTarget);
381381
var $imageContainer = $checkbox.closest('[data-role=dialog]').data('imageContainer');
382382
$imageContainer.toggleClass('hidden-for-front', $checkbox.is(':checked'));
383+
$imageContainer.find('[name*="disabled"]').val($checkbox.is(':checked') ? 1 : 0);
383384
},
384385

385386
/**

app/code/Magento/CatalogImportExport/Model/Export/Product.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -928,13 +928,14 @@ protected function collectMultirawData()
928928
array_keys($this->_websiteIdToCode),
929929
$item->getWebsites()
930930
);
931-
$rowCategories[$item->getId()] = $item->getCategoryIds();
931+
$rowCategories[$item->getId()] = array_combine($item->getCategoryIds(), $item->getCategoryIds());
932932
}
933933
$collection->clear();
934934

935935
$allCategoriesIds = array_merge(array_keys($this->_categories), array_keys($this->_rootCategories));
936+
$allCategoriesIds = array_combine($allCategoriesIds, $allCategoriesIds);
936937
foreach ($rowCategories as &$categories) {
937-
$categories = array_intersect($categories, $allCategoriesIds);
938+
$categories = array_intersect_key($categories, $allCategoriesIds);
938939
}
939940

940941
$data['rowWebsites'] = $rowWebsites;
@@ -1218,14 +1219,16 @@ protected function getCustomOptionsData($productIds)
12181219
public function filterAttributeCollection(\Magento\Eav\Model\Resource\Entity\Attribute\Collection $collection)
12191220
{
12201221
$validTypes = array_keys($this->_productTypeModels);
1222+
$validTypes = array_combine($validTypes, $validTypes);
12211223

12221224
foreach (parent::filterAttributeCollection($collection) as $attribute) {
12231225
if (in_array($attribute->getAttributeCode(), $this->_bannedAttributes)) {
12241226
$collection->removeItemByKey($attribute->getId());
12251227
continue;
12261228
}
12271229
$attrApplyTo = $attribute->getApplyTo();
1228-
$attrApplyTo = $attrApplyTo ? array_intersect($attrApplyTo, $validTypes) : $validTypes;
1230+
$attrApplyTo = array_combine($attrApplyTo, $attrApplyTo);
1231+
$attrApplyTo = $attrApplyTo ? array_intersect_key($attrApplyTo, $validTypes) : $validTypes;
12291232

12301233
if ($attrApplyTo) {
12311234
foreach ($attrApplyTo as $productType) {

app/code/Magento/Customer/Model/Customer/DataProvider.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,7 @@ public function getData()
131131
$addresses[$addressId] = $address->getData();
132132
$this->prepareAddressData($addressId, $addresses, $result['customer']);
133133
}
134-
if (!empty($addresses)) {
135-
$result['address'] = $addresses;
136-
}
134+
$result['address'] = $addresses;
137135

138136
$this->loadedData[$customer->getId()] = $result;
139137
}

app/code/Magento/LayeredNavigation/view/frontend/templates/layer/filter.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
/**
1212
* Template for filter items block
1313
*
14-
* @var $block \Magento\LayeredNavigation\Block\Layer\Filter\Renderer
14+
* @var $block \Magento\LayeredNavigation\Block\Navigation\FilterRenderer
1515
*/
1616
?>
1717

app/code/Magento/Sales/Model/Order/Payment/Operations/CaptureOperation.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,14 @@ public function capture(OrderPaymentInterface $payment, $invoice)
8181
//TODO replace for sale usage
8282
$method->capture($payment, $amountToCapture);
8383

84-
$transaction = $this->transactionBuilder->setPayment($this)
85-
->setOrder($order)
86-
->setFailSafe(true)
87-
->setTransactionId($payment->getTransactionId())
88-
->setAdditionalInformation($payment->getTransactionAdditionalInfo())
89-
->setSalesDocument($invoice)->build(Transaction::TYPE_CAPTURE);
84+
$transactionBuilder = $this->transactionBuilder->setPayment($payment);
85+
$transactionBuilder->setOrder($order);
86+
$transactionBuilder->setFailSafe(true);
87+
$transactionBuilder->setTransactionId($payment->getTransactionId());
88+
$transactionBuilder->setAdditionalInformation($payment->getTransactionAdditionalInfo());
89+
$transactionBuilder->setSalesDocument($invoice);
90+
$transaction = $transactionBuilder->build(Transaction::TYPE_CAPTURE);
91+
9092
$message = $this->stateCommand->execute($payment, $amountToCapture, $order);
9193
if ($payment->getIsTransactionPending()) {
9294
$invoice->setIsPaid(false);

app/code/Magento/Sales/Model/Order/Payment/Transaction/Builder.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,9 @@ public function build($type)
186186
$transaction = $this->transactionRepository->create()->setTxnId($this->transactionId);
187187
}
188188
$transaction->setPaymentId($this->payment->getId())
189+
->setPayment($this->payment)
189190
->setOrderId($this->order->getId())
191+
->setOrder($this->order)
190192
->setTxnType($type)
191193
->isFailsafe($this->failSafe);
192194

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Sales\Test\Unit\Model\Order\Payment\Operations;
8+
9+
use Magento\Framework\ObjectManager\ObjectManager;
10+
use Magento\Payment\Model\Method;
11+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
12+
13+
class CaptureOperationTest extends \PHPUnit_Framework_TestCase
14+
{
15+
/**
16+
* @var \PHPUnit_Framework_MockObject_MockObject
17+
*/
18+
protected $transactionManager;
19+
20+
/**
21+
* @var \PHPUnit_Framework_MockObject_MockObject
22+
*/
23+
protected $eventManager;
24+
25+
/**
26+
* @var \PHPUnit_Framework_MockObject_MockObject
27+
*/
28+
protected $transactionBuilder;
29+
30+
/**
31+
* @var \PHPUnit_Framework_MockObject_MockObject
32+
*/
33+
protected $stateCommand;
34+
35+
/**
36+
* @var \Magento\Sales\Model\Order\Payment\Operations\CaptureOperation
37+
*/
38+
protected $model;
39+
40+
protected function setUp()
41+
{
42+
$transactionClass = 'Magento\Sales\Model\Order\Payment\Transaction\ManagerInterface';
43+
$transactionBuilderClass = 'Magento\Sales\Model\Order\Payment\Transaction\BuilderInterface';
44+
$this->transactionManager = $this->getMockBuilder($transactionClass)
45+
->disableOriginalConstructor()
46+
->getMock();
47+
$this->eventManager = $this->getMockBuilder('Magento\Framework\Event\ManagerInterface')
48+
->disableOriginalConstructor()
49+
->getMock();
50+
$this->transactionBuilder = $this->getMockBuilder($transactionBuilderClass)
51+
->disableOriginalConstructor()
52+
->getMock();
53+
$this->stateCommand = $this->getMockBuilder('Magento\Sales\Model\Order\Payment\State\CommandInterface')
54+
->disableOriginalConstructor()
55+
->getMock();
56+
$objectManagerHelper = new ObjectManagerHelper($this);
57+
$this->model = $objectManagerHelper->getObject(
58+
'Magento\Sales\Model\Order\Payment\Operations\CaptureOperation',
59+
[
60+
'transactionManager' => $this->transactionManager,
61+
'eventManager' => $this->eventManager,
62+
'transactionBuilder' => $this->transactionBuilder,
63+
'stateCommand' => $this->stateCommand
64+
]
65+
);
66+
}
67+
68+
public function testCapture()
69+
{
70+
$baseGrandTotal = 10;
71+
72+
$order = $this->getMockBuilder('Magento\Sales\Model\Order')
73+
->disableOriginalConstructor()
74+
->getMock();
75+
76+
$paymentMethod = $this->getMockBuilder('Magento\Payment\Model\MethodInterface')
77+
->disableOriginalConstructor()
78+
->getMock();
79+
80+
$orderPayment = $this->getMockBuilder('Magento\Sales\Model\Order\Payment')
81+
->disableOriginalConstructor()
82+
->getMock();
83+
$orderPayment->expects($this->any())
84+
->method('formatAmount')
85+
->with($baseGrandTotal)
86+
->willReturnArgument(0);
87+
$orderPayment->expects($this->any())
88+
->method('getOrder')
89+
->willReturn($order);
90+
$orderPayment->expects($this->any())
91+
->method('getMethodInstance')
92+
->willReturn($paymentMethod);
93+
$orderPayment->expects($this->once())
94+
->method('getIsTransactionPending')
95+
->willReturn(true);
96+
$orderPayment->expects($this->once())
97+
->method('getTransactionAdditionalInfo')
98+
->willReturn([]);
99+
100+
$paymentMethod->expects($this->once())
101+
->method('capture')
102+
->with($orderPayment, $baseGrandTotal);
103+
104+
$this->transactionBuilder->expects($this->once())
105+
->method('setPayment')
106+
->with($orderPayment)
107+
->willReturnSelf();
108+
109+
$invoice = $this->getMockBuilder('Magento\Sales\Model\Order\Invoice')
110+
->disableOriginalConstructor()
111+
->getMock();
112+
$invoice->expects($this->any())
113+
->method('getBaseGrandTotal')
114+
->willReturn($baseGrandTotal);
115+
116+
$this->model->capture($orderPayment, $invoice);
117+
}
118+
}

app/code/Magento/Sales/Test/Unit/Model/Order/Payment/Transaction/BuilderTest.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,14 @@ public function testCreate(
9999
$parentTransaction = $this->expectTransaction($orderId, $paymentId);
100100
$transaction = $this->expectTransaction($orderId, $paymentId);
101101
$transaction->expects($this->atLeastOnce())->method('getTxnId')->willReturn($transactionId);
102+
$transaction->expects($this->once())
103+
->method('setPayment')
104+
->withAnyParameters()
105+
->willReturnSelf();
106+
$transaction->expects($this->once())
107+
->method('setOrder')
108+
->withAnyParameters()
109+
->willReturnSelf();
102110

103111
if ($isTransactionExists) {
104112
$this->repositoryMock->method('getByTransactionId')
@@ -210,7 +218,9 @@ protected function expectTransaction($orderId, $paymentId)
210218
'setAdditionalInformation',
211219
'setParentTxnId',
212220
'close',
213-
'getIsClosed'
221+
'getIsClosed',
222+
'setPayment',
223+
'setOrder'
214224
],
215225
[],
216226
'',

app/code/Magento/User/Model/User.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,9 @@ public function verifyIdentity($password)
470470
$result = false;
471471
if ($this->_encryptor->validateHash($password, $this->getPassword())) {
472472
if ($this->getIsActive() != '1') {
473-
throw new AuthenticationException(__('This account is inactive.'));
473+
throw new AuthenticationException(
474+
__('You did not sign in correctly or your account is temporarily disabled.')
475+
);
474476
}
475477
if (!$this->hasAssigned2Role($this->getId())) {
476478
throw new AuthenticationException(__('You need more permissions to access this.'));

app/code/Magento/User/Test/Unit/Model/UserTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ public function testVerifyIdentityInactiveRecord()
364364
$this->_model->setIsActive(false);
365365
$this->setExpectedException(
366366
'Magento\\Framework\\Exception\\AuthenticationException',
367-
'This account is inactive.'
367+
'You did not sign in correctly or your account is temporarily disabled.'
368368
);
369369
$this->_model->verifyIdentity($password);
370370
}

app/code/Magento/User/i18n/de_DE.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Permissions,Permissions
8585
"Your password must be at least %1 characters.","Your password must be at least %1 characters."
8686
"Your password must include both numeric and alphabetic characters.","Your password must include both numeric and alphabetic characters."
8787
"Your password confirmation must match your password.","Your password confirmation must match your password."
88-
"This account is inactive.","This account is inactive."
88+
"You did not sign in correctly or your account is temporarily disabled.","You did not sign in correctly or your account is temporarily disabled."
8989
"Forgot your user name or password?","Forgot your user name or password?"
9090
"Retrieve Password","Retrieve Password"
9191
"Forgot your password?","Forgot your password?"

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Permissions,Permissions
8585
"Your password must be at least %1 characters.","Your password must be at least %1 characters."
8686
"Your password must include both numeric and alphabetic characters.","Your password must include both numeric and alphabetic characters."
8787
"Your password confirmation must match your password.","Your password confirmation must match your password."
88-
"This account is inactive.","This account is inactive."
88+
"You did not sign in correctly or your account is temporarily disabled.","You did not sign in correctly or your account is temporarily disabled."
8989
"Forgot your user name or password?","Forgot your user name or password?"
9090
"Retrieve Password","Retrieve Password"
9191
"Forgot your password?","Forgot your password?"

app/code/Magento/User/i18n/es_ES.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Permissions,Permissions
8585
"Your password must be at least %1 characters.","Your password must be at least %1 characters."
8686
"Your password must include both numeric and alphabetic characters.","Your password must include both numeric and alphabetic characters."
8787
"Your password confirmation must match your password.","Your password confirmation must match your password."
88-
"This account is inactive.","This account is inactive."
88+
"You did not sign in correctly or your account is temporarily disabled.","You did not sign in correctly or your account is temporarily disabled."
8989
"Forgot your user name or password?","Forgot your user name or password?"
9090
"Retrieve Password","Retrieve Password"
9191
"Forgot your password?","Forgot your password?"

app/code/Magento/User/i18n/fr_FR.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Permissions,Permissions
8585
"Your password must be at least %1 characters.","Your password must be at least %1 characters."
8686
"Your password must include both numeric and alphabetic characters.","Your password must include both numeric and alphabetic characters."
8787
"Your password confirmation must match your password.","Your password confirmation must match your password."
88-
"This account is inactive.","This account is inactive."
88+
"You did not sign in correctly or your account is temporarily disabled.","You did not sign in correctly or your account is temporarily disabled."
8989
"Forgot your user name or password?","Forgot your user name or password?"
9090
"Retrieve Password","Retrieve Password"
9191
"Forgot your password?","Forgot your password?"

app/code/Magento/User/i18n/nl_NL.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Permissions,Permissions
8585
"Your password must be at least %1 characters.","Your password must be at least %1 characters."
8686
"Your password must include both numeric and alphabetic characters.","Your password must include both numeric and alphabetic characters."
8787
"Your password confirmation must match your password.","Your password confirmation must match your password."
88-
"This account is inactive.","This account is inactive."
88+
"You did not sign in correctly or your account is temporarily disabled.","You did not sign in correctly or your account is temporarily disabled."
8989
"Forgot your user name or password?","Forgot your user name or password?"
9090
"Retrieve Password","Retrieve Password"
9191
"Forgot your password?","Forgot your password?"

app/code/Magento/User/i18n/pt_BR.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Permissions,Permissions
8585
"Your password must be at least %1 characters.","Your password must be at least %1 characters."
8686
"Your password must include both numeric and alphabetic characters.","Your password must include both numeric and alphabetic characters."
8787
"Your password confirmation must match your password.","Your password confirmation must match your password."
88-
"This account is inactive.","This account is inactive."
88+
"You did not sign in correctly or your account is temporarily disabled.","You did not sign in correctly or your account is temporarily disabled."
8989
"Forgot your user name or password?","Forgot your user name or password?"
9090
"Retrieve Password","Retrieve Password"
9191
"Forgot your password?","Forgot your password?"

app/code/Magento/User/i18n/zh_CN.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Permissions,Permissions
8585
"Your password must be at least %1 characters.","Your password must be at least %1 characters."
8686
"Your password must include both numeric and alphabetic characters.","Your password must include both numeric and alphabetic characters."
8787
"Your password confirmation must match your password.","Your password confirmation must match your password."
88-
"This account is inactive.","This account is inactive."
88+
"You did not sign in correctly or your account is temporarily disabled.","You did not sign in correctly or your account is temporarily disabled."
8989
"Forgot your user name or password?","Forgot your user name or password?"
9090
"Retrieve Password","Retrieve Password"
9191
"Forgot your password?","Forgot your password?"

app/code/Magento/User/view/adminhtml/templates/admin/resetforgottenpassword.phtml

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

99
?>
1010

11-
<form method="post" data-mage-init='{"form": {}, "validation": {}}' action="<?php echo $block->getUrl('*/auth/resetpasswordpost', ['_query' => ['id' => $block->getUserId(), 'token' => $block->getResetPasswordLinkToken()]]); ?>" id="reset-password-form">
11+
<form method="post" data-mage-init='{"form": {}, "validation": {}}' action="<?php echo $block->getUrl('*/auth/resetpasswordpost', ['_query' => ['id' => $block->getUserId(), 'token' => $block->getResetPasswordLinkToken()]]); ?>" id="reset-password-form" autocomplete="off">
1212
<fieldset class="admin__fieldset">
1313
<legend class="admin__legend"><span><?php echo __('Reset a Password'); ?></span></legend><br />
1414
<input name="form_key" type="hidden" value="<?php echo $block->getFormKey(); ?>" />

app/code/Magento/Webapi/Test/Unit/Model/Authorization/OauthUserContextTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ protected function setUp()
7070

7171
$this->oauthRequestHelper = $this->getMockBuilder('Magento\Framework\Oauth\Helper\Request')
7272
->disableOriginalConstructor()
73-
->setMethods(['prepareRequest'])
73+
->setMethods(['prepareRequest', 'getRequestUrl'])
7474
->getMock();
7575

7676
$this->oauthService = $this->getMockBuilder('Magento\Framework\Oauth\Oauth')

dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/RequestTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ protected function setUp()
1818
{
1919
$this->_model = new \Magento\TestFramework\Request(
2020
$this->getMock('Magento\Framework\Stdlib\Cookie\CookieReaderInterface'),
21+
$this->getMock('Magento\Framework\Stdlib\StringUtils'),
2122
$this->getMock('Magento\Framework\App\Route\ConfigInterface\Proxy', [], [], '', false),
2223
$this->getMock('Magento\Framework\App\Request\PathInfoProcessorInterface'),
2324
$this->getMock('Magento\Framework\ObjectManagerInterface')

lib/internal/Magento/Framework/App/Request/Http.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<?php
22
/**
3-
* Http request
4-
*
53
* Copyright © 2015 Magento. All rights reserved.
64
* See COPYING.txt for license details.
75
*/
@@ -13,7 +11,11 @@
1311
use Magento\Framework\HTTP\PhpEnvironment\Request;
1412
use Magento\Framework\ObjectManagerInterface;
1513
use Magento\Framework\Stdlib\Cookie\CookieReaderInterface;
14+
use Magento\Framework\Stdlib\StringUtils;
1615

16+
/**
17+
* Http request
18+
*/
1719
class Http extends Request implements RequestInterface
1820
{
1921
/**#@+
@@ -79,6 +81,7 @@ class Http extends Request implements RequestInterface
7981

8082
/**
8183
* @param CookieReaderInterface $cookieReader
84+
* @param StringUtils $converter
8285
* @param ConfigInterface $routeConfig
8386
* @param PathInfoProcessorInterface $pathInfoProcessor
8487
* @param ObjectManagerInterface $objectManager
@@ -87,13 +90,14 @@ class Http extends Request implements RequestInterface
8790
*/
8891
public function __construct(
8992
CookieReaderInterface $cookieReader,
93+
StringUtils $converter,
9094
ConfigInterface $routeConfig,
9195
PathInfoProcessorInterface $pathInfoProcessor,
9296
ObjectManagerInterface $objectManager,
9397
$uri = null,
9498
$directFrontNames = []
9599
) {
96-
parent::__construct($cookieReader, $uri);
100+
parent::__construct($cookieReader, $converter, $uri);
97101
$this->routeConfig = $routeConfig;
98102
$this->pathInfoProcessor = $pathInfoProcessor;
99103
$this->objectManager = $objectManager;
@@ -302,6 +306,7 @@ public function isAjax()
302306
public function getDistroBaseUrl()
303307
{
304308
$headerHttpHost = $this->getServer('HTTP_HOST');
309+
$headerHttpHost = $this->converter->cleanString($headerHttpHost);
305310
$headerServerPort = $this->getServer('SERVER_PORT');
306311
$headerScriptName = $this->getServer('SCRIPT_NAME');
307312
$headerHttps = $this->getServer('HTTPS');

0 commit comments

Comments
 (0)