Skip to content

Commit 6116023

Browse files
🔃 [EngCom] Public Pull Requests - 2.3-develop
Accepted Public Pull Requests: - #17475: [Forwardport] Convert to string $option->getValue, in order to be compared with oth� (by @mage2pratik) - #17472: [Forwardport] [Braintree] Added unit test for instant purchase PayPal token formatter (by @mage2pratik) - #17470: small misspelling fixed (by @EmilyPepperman) - #17102: [Forwardport] Refactory to Magento_Backend module class. (by @tiagosampaio) - #17449: [Forwardport] MAGETWO-84608: Cannot perform setup:install if Redis needs a password� (by @mage2pratik) - #17448: [Forwardport] Allows modules with underscores in name to set custom a frontend_model in system.xml (by @mage2pratik) - #17438: [Forwardport] fix: remove disabled attribute on region list (by @DanielRuf) - #17410: Replacing deprecated methods from Magento_Sales module. (by @tiagosampaio) - #17431: [Forwardport] Remove unnecessary translation of HTML tags (by @yogeshks) - #17394: Declare module namespace before template path name (by @mage2pratik) - #17446: [Forwardport] Improvements in UI component MassActions (by @alexeya-ven) - #17350: [Forwardport] Fix false cache_lifetime usage in xml layouts (by @jignesh-baldha) Fixed GitHub Issues: - #15028: Configurable product addtocart with restAPI not working as expected (reported by @yspeedwicked) has been fixed in #17475 by @mage2pratik in 2.3-develop branch Related commits: 1. 51456f7
2 parents 12fb1cb + db0522f commit 6116023

File tree

110 files changed

+594
-264
lines changed

Some content is hidden

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

110 files changed

+594
-264
lines changed

app/code/Magento/Backend/Block/System/Store/Delete/Group.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ protected function _prepareLayout()
1919
{
2020
$itemId = $this->getRequest()->getParam('group_id');
2121

22-
$this->setTemplate('system/store/delete_group.phtml');
22+
$this->setTemplate('Magento_Backend::system/store/delete_group.phtml');
2323
$this->setAction($this->getUrl('adminhtml/*/deleteGroupPost', ['group_id' => $itemId]));
2424
$this->addChild(
2525
'confirm_deletion_button',

app/code/Magento/Backend/Block/System/Store/Delete/Website.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ protected function _prepareLayout()
1919
{
2020
$itemId = $this->getRequest()->getParam('website_id');
2121

22-
$this->setTemplate('system/store/delete_website.phtml');
22+
$this->setTemplate('Magento_Backend::system/store/delete_website.phtml');
2323
$this->setAction($this->getUrl('adminhtml/*/deleteWebsitePost', ['website_id' => $itemId]));
2424
$this->addChild(
2525
'confirm_deletion_button',

app/code/Magento/Backend/Helper/Dashboard/Order.php

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* @api
1414
* @since 100.0.2
1515
*/
16-
class Order extends \Magento\Backend\Helper\Dashboard\AbstractDashboard
16+
class Order extends AbstractDashboard
1717
{
1818
/**
1919
* @var \Magento\Reports\Model\ResourceModel\Order\Collection
@@ -29,32 +29,25 @@ class Order extends \Magento\Backend\Helper\Dashboard\AbstractDashboard
2929
/**
3030
* @param \Magento\Framework\App\Helper\Context $context
3131
* @param \Magento\Reports\Model\ResourceModel\Order\Collection $orderCollection
32+
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
3233
*/
3334
public function __construct(
3435
\Magento\Framework\App\Helper\Context $context,
35-
\Magento\Reports\Model\ResourceModel\Order\Collection $orderCollection
36+
\Magento\Reports\Model\ResourceModel\Order\Collection $orderCollection,
37+
\Magento\Store\Model\StoreManagerInterface $storeManager = null
3638
) {
3739
$this->_orderCollection = $orderCollection;
38-
parent::__construct($context);
39-
}
40+
$this->_storeManager = $storeManager ?: ObjectManager::getInstance()
41+
->get(\Magento\Store\Model\StoreManagerInterface::class);
4042

41-
/**
42-
* The getter function to get the new StoreManager dependency
43-
*
44-
* @return \Magento\Store\Model\StoreManagerInterface
45-
*
46-
* @deprecated 100.1.0
47-
*/
48-
private function getStoreManager()
49-
{
50-
if ($this->_storeManager === null) {
51-
$this->_storeManager = ObjectManager::getInstance()->get(\Magento\Store\Model\StoreManagerInterface::class);
52-
}
53-
return $this->_storeManager;
43+
parent::__construct($context);
5444
}
5545

5646
/**
5747
* @return void
48+
*
49+
* @throws \Magento\Framework\Exception\LocalizedException
50+
* @throws \Magento\Framework\Exception\NoSuchEntityException
5851
*/
5952
protected function _initCollection()
6053
{
@@ -65,15 +58,15 @@ protected function _initCollection()
6558
if ($this->getParam('store')) {
6659
$this->_collection->addFieldToFilter('store_id', $this->getParam('store'));
6760
} elseif ($this->getParam('website')) {
68-
$storeIds = $this->getStoreManager()->getWebsite($this->getParam('website'))->getStoreIds();
61+
$storeIds = $this->_storeManager->getWebsite($this->getParam('website'))->getStoreIds();
6962
$this->_collection->addFieldToFilter('store_id', ['in' => implode(',', $storeIds)]);
7063
} elseif ($this->getParam('group')) {
71-
$storeIds = $this->getStoreManager()->getGroup($this->getParam('group'))->getStoreIds();
64+
$storeIds = $this->_storeManager->getGroup($this->getParam('group'))->getStoreIds();
7265
$this->_collection->addFieldToFilter('store_id', ['in' => implode(',', $storeIds)]);
7366
} elseif (!$this->_collection->isLive()) {
7467
$this->_collection->addFieldToFilter(
7568
'store_id',
76-
['eq' => $this->getStoreManager()->getStore(\Magento\Store\Model\Store::ADMIN_CODE)->getId()]
69+
['eq' => $this->_storeManager->getStore(\Magento\Store\Model\Store::ADMIN_CODE)->getId()]
7770
);
7871
}
7972
$this->_collection->load();
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Braintree\Test\Unit\Model\InstantPurchase\PayPal;
9+
10+
use Magento\Braintree\Model\InstantPurchase\CreditCard\TokenFormatter as PaypalTokenFormatter;
11+
use Magento\Vault\Api\Data\PaymentTokenInterface;
12+
13+
class TokenFormatterTest extends \PHPUnit\Framework\TestCase
14+
{
15+
/**
16+
* @var PaymentTokenInterface|\PHPUnit_Framework_MockObject_MockObject
17+
*/
18+
private $paymentTokenMock;
19+
20+
/**
21+
* @var PaypalTokenFormatter
22+
*/
23+
private $paypalTokenFormatter;
24+
25+
/**
26+
* @var array
27+
*/
28+
private $tokenDetails = [
29+
'type' => 'visa',
30+
'maskedCC' => '4444************9999',
31+
'expirationDate' => '07-07-2025'
32+
];
33+
34+
/**
35+
* Test setup
36+
*/
37+
protected function setUp()
38+
{
39+
$this->paymentTokenMock = $this->getMockBuilder(PaymentTokenInterface::class)
40+
->getMockForAbstractClass();
41+
42+
$this->paypalTokenFormatter = new PaypalTokenFormatter();
43+
}
44+
45+
/**
46+
* testFormatPaymentTokenWithKnownCardType
47+
*/
48+
public function testFormatPaymentTokenWithKnownCardType()
49+
{
50+
$this->tokenDetails['type'] = key(PaypalTokenFormatter::$baseCardTypes);
51+
$this->paymentTokenMock->expects($this->once())
52+
->method('getTokenDetails')
53+
->willReturn(json_encode($this->tokenDetails));
54+
55+
$formattedString = sprintf(
56+
'%s: %s, %s: %s (%s: %s)',
57+
__('Credit Card'),
58+
reset(PaypalTokenFormatter::$baseCardTypes),
59+
__('ending'),
60+
$this->tokenDetails['maskedCC'],
61+
__('expires'),
62+
$this->tokenDetails['expirationDate']
63+
);
64+
65+
self::assertEquals($formattedString, $this->paypalTokenFormatter->formatPaymentToken($this->paymentTokenMock));
66+
}
67+
68+
/**
69+
* testFormatPaymentTokenWithUnknownCardType
70+
*/
71+
public function testFormatPaymentTokenWithUnknownCardType()
72+
{
73+
$this->paymentTokenMock->expects($this->once())
74+
->method('getTokenDetails')
75+
->willReturn(json_encode($this->tokenDetails));
76+
77+
$formattedString = sprintf(
78+
'%s: %s, %s: %s (%s: %s)',
79+
__('Credit Card'),
80+
$this->tokenDetails['type'],
81+
__('ending'),
82+
$this->tokenDetails['maskedCC'],
83+
__('expires'),
84+
$this->tokenDetails['expirationDate']
85+
);
86+
87+
self::assertEquals($formattedString, $this->paypalTokenFormatter->formatPaymentToken($this->paymentTokenMock));
88+
}
89+
90+
/**
91+
* testFormatPaymentTokenWithWrongData
92+
*/
93+
public function testFormatPaymentTokenWithWrongData()
94+
{
95+
unset($this->tokenDetails['type']);
96+
97+
$this->paymentTokenMock->expects($this->once())
98+
->method('getTokenDetails')
99+
->willReturn(json_encode($this->tokenDetails));
100+
self::expectException('\InvalidArgumentException');
101+
102+
$this->paypalTokenFormatter->formatPaymentToken($this->paymentTokenMock);
103+
}
104+
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class Tree extends \Magento\Catalog\Block\Adminhtml\Category\Tree
3030
*/
3131
protected function _prepareLayout()
3232
{
33-
$this->setTemplate('catalog/category/checkboxes/tree.phtml');
33+
$this->setTemplate('Magento_Catalog::catalog/category/checkboxes/tree.phtml');
3434
}
3535

3636
/**

app/code/Magento/Catalog/Block/Adminhtml/Form/Renderer/Config/YearRange.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,9 @@ protected function _getElementHtml(AbstractElement $element)
3232

3333
$from = $element->setValue(isset($values[0]) ? $values[0] : null)->getElementHtml();
3434
$to = $element->setValue(isset($values[1]) ? $values[1] : null)->getElementHtml();
35-
return __(
36-
'<label class="label"><span>from</span></label>'
37-
) . $from . __(
38-
'<label class="label"><span>to</span></label>'
39-
) . $to;
35+
return '<label class="label"><span>' . __('from') . '</span></label>'
36+
. $from .
37+
'<label class="label"><span>' . __('to') . '</span></label>'
38+
. $to;
4039
}
4140
}

app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Ajax/Serializer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function __construct(
4141
public function _construct()
4242
{
4343
parent::_construct();
44-
$this->setTemplate('catalog/product/edit/serializer.phtml');
44+
$this->setTemplate('Magento_Catalog::catalog/product/edit/serializer.phtml');
4545
return $this;
4646
}
4747

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ Position,Position
1313
Day,Day
1414
Month,Month
1515
Year,Year
16-
"<label class=""label""><span>from</span></label>","<label class=""label""><span>from</span></label>"
17-
"<label class=""label""><span>to</span></label>","<label class=""label""><span>to</span></label>"
16+
from,from
17+
to,to
1818
[GLOBAL],[GLOBAL]
1919
[WEBSITE],[WEBSITE]
2020
"[STORE VIEW]","[STORE VIEW]"

app/code/Magento/Checkout/view/frontend/web/js/region-updater.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,8 @@ define([
188188

189189
if (!this.options.optionalRegionAllowed) { //eslint-disable-line max-depth
190190
regionList.attr('disabled', 'disabled');
191+
} else {
192+
regionList.removeAttr('disabled');
191193
}
192194
}
193195

app/code/Magento/Config/etc/system_file.xsd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@
474474
</xs:documentation>
475475
</xs:annotation>
476476
<xs:restriction base="xs:string">
477-
<xs:pattern value="[A-Za-z0-9\\:]+" />
477+
<xs:pattern value="[A-Za-z0-9_\\:]+" />
478478
<xs:minLength value="5" />
479479
</xs:restriction>
480480
</xs:simpleType>

app/code/Magento/ConfigurableProduct/Model/Quote/Item/CartItemProcessor.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function __construct(
5959
}
6060

6161
/**
62-
* {@inheritdoc}
62+
* @inheritdoc
6363
*/
6464
public function convertToBuyRequest(CartItemInterface $cartItem)
6565
{
@@ -69,7 +69,7 @@ public function convertToBuyRequest(CartItemInterface $cartItem)
6969
if (is_array($options)) {
7070
$requestData = [];
7171
foreach ($options as $option) {
72-
$requestData['super_attribute'][$option->getOptionId()] = $option->getOptionValue();
72+
$requestData['super_attribute'][$option->getOptionId()] = (string) $option->getOptionValue();
7373
}
7474
return $this->objectFactory->create($requestData);
7575
}
@@ -78,7 +78,7 @@ public function convertToBuyRequest(CartItemInterface $cartItem)
7878
}
7979

8080
/**
81-
* {@inheritdoc}
81+
* @inheritdoc
8282
*/
8383
public function processOptions(CartItemInterface $cartItem)
8484
{

app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Cart.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ protected function _construct()
8282
parent::_construct();
8383
$this->setUseAjax(true);
8484
$this->_parentTemplate = $this->getTemplate();
85-
$this->setTemplate('tab/cart.phtml');
85+
$this->setTemplate('Magento_Customer::tab/cart.phtml');
8686
}
8787

8888
/**
@@ -220,7 +220,7 @@ public function getGridParentHtml()
220220
}
221221

222222
/**
223-
* {@inheritdoc}
223+
* @inheritdoc
224224
*/
225225
public function getRowUrl($row)
226226
{

app/code/Magento/Customer/Block/Adminhtml/System/Config/Validatevat.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ protected function _prepareLayout()
9999
{
100100
parent::_prepareLayout();
101101
if (!$this->getTemplate()) {
102-
$this->setTemplate('system/config/validatevat.phtml');
102+
$this->setTemplate('Magento_Customer::system/config/validatevat.phtml');
103103
}
104104
return $this;
105105
}

app/code/Magento/Customer/Block/Widget/Company.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ class Company extends AbstractWidget
4040
protected $options;
4141

4242
/**
43-
* @param Context $context
44-
* @param AddressHelper $addressHelper
43+
* @param Context $context
44+
* @param AddressHelper $addressHelper
4545
* @param CustomerMetadataInterface $customerMetadata
46-
* @param Options $options
47-
* @param AddressMetadataInterface $addressMetadata
48-
* @param array $data
46+
* @param Options $options
47+
* @param AddressMetadataInterface $addressMetadata
48+
* @param array $data
4949
*/
5050
public function __construct(
5151
Context $context,
@@ -69,7 +69,7 @@ public function _construct()
6969
parent::_construct();
7070

7171
// default template location
72-
$this->setTemplate('widget/company.phtml');
72+
$this->setTemplate('Magento_Customer::widget/company.phtml');
7373
}
7474

7575
/**
@@ -95,7 +95,7 @@ public function showCompany()
9595
}
9696

9797
/**
98-
* {@inheritdoc}
98+
* @inheritdoc
9999
*/
100100
protected function _getAttribute($attributeCode)
101101
{

app/code/Magento/Customer/Block/Widget/Dob.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function __construct(
6666
public function _construct()
6767
{
6868
parent::_construct();
69-
$this->setTemplate('widget/dob.phtml');
69+
$this->setTemplate('Magento_Customer::widget/dob.phtml');
7070
}
7171

7272
/**

app/code/Magento/Customer/Block/Widget/Fax.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ class Fax extends AbstractWidget
4040
protected $options;
4141

4242
/**
43-
* @param Context $context
44-
* @param AddressHelper $addressHelper
43+
* @param Context $context
44+
* @param AddressHelper $addressHelper
4545
* @param CustomerMetadataInterface $customerMetadata
46-
* @param Options $options
47-
* @param AddressMetadataInterface $addressMetadata
48-
* @param array $data
46+
* @param Options $options
47+
* @param AddressMetadataInterface $addressMetadata
48+
* @param array $data
4949
*/
5050
public function __construct(
5151
Context $context,
@@ -69,7 +69,7 @@ public function _construct()
6969
parent::_construct();
7070

7171
// default template location
72-
$this->setTemplate('widget/fax.phtml');
72+
$this->setTemplate('Magento_Customer::widget/fax.phtml');
7373
}
7474

7575
/**
@@ -95,7 +95,7 @@ public function showFax()
9595
}
9696

9797
/**
98-
* {@inheritdoc}
98+
* @inheritdoc
9999
*/
100100
protected function _getAttribute($attributeCode)
101101
{

app/code/Magento/Customer/Block/Widget/Gender.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function __construct(
5959
public function _construct()
6060
{
6161
parent::_construct();
62-
$this->setTemplate('widget/gender.phtml');
62+
$this->setTemplate('Magento_Customer::widget/gender.phtml');
6363
}
6464

6565
/**

0 commit comments

Comments
 (0)