Skip to content

Commit 7fc1ef6

Browse files
authored
🔃 [EngCom] Public Pull Requests - 2.3-develop
Accepted Public Pull Requests: - #18573: Update documentation for Order#getAppliedRuleIds (by @zack6849) - #18638: [Forwardport] Calendar icon in advance pricing alignment solved (by @speedy008) - #18608: Replace intval() function by using direct type casting to (int) (by @mage2pratik) - #18596: Fix empty cart button (by @luukschakenraad) - #18600: Fix the typo in PHPDoc comment (by @dmytro-ch) - #18571: [Forwardport] Fix Customer custom attributes lost after save (by @gelanivishal) - #18570: [Forwardport] Fix for custom product attribute changing 'backend_type' when 'is_use� (by @gelanivishal) - #18546: Backend: add missing unit test for ModuleService class (by @dmytro-ch) - #17800: Updating error message for misleading error in add product attribute code (by @aman3103) Fixed GitHub Issues: - #18581: Calendar Icon aligement Issue (reported by @jignesh26) has been fixed in #18638 by @speedy008 in 2.3-develop branch Related commits: 1. 039c88d - #18475: "Clear Shopping Cart" in Magento Blank theme no longer working after 2.2.6 (reported by @dewayneholden) has been fixed in #18596 by @luukschakenraad in 2.3-develop branch Related commits: 1. cc3835f - #18589: Empty cart button does not work (reported by @luukschakenraad) has been fixed in #18596 by @luukschakenraad in 2.3-develop branch Related commits: 1. cc3835f - #12479: Saving Customer Model directly causes loss of data (reported by @Danielc3) has been fixed in #18571 by @gelanivishal in 2.3-develop branch Related commits: 1. 2322baf 2. ce82c5c 3. 9707676 - #9219: Custom Product Attribute changes 'backend_type' when 'is_user_defined = 1' and get updated/saved in Admin Backend (reported by @mhauri) has been fixed in #18570 by @gelanivishal in 2.3-develop branch Related commits: 1. 40e128c - #17754: Misleading error in Add Product Attribute screen (reported by @milossh) has been fixed in #17800 by @aman3103 in 2.3-develop branch Related commits: 1. 9aa4cfa 2. 18e509c 3. 9a15e1f 4. 6a0485f 5. b6a899f
2 parents f710f9b + 818fa86 commit 7fc1ef6

File tree

49 files changed

+324
-117
lines changed

Some content is hidden

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

49 files changed

+324
-117
lines changed

app/code/Magento/Backend/Model/Config/SessionLifetime/BackendModel.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,17 @@
1616
*/
1717
class BackendModel extends Value
1818
{
19-
/** Maximum dmin session lifetime; 1 year*/
19+
/** Maximum admin session lifetime; 1 year*/
2020
const MAX_LIFETIME = 31536000;
2121

2222
/** Minimum admin session lifetime */
2323
const MIN_LIFETIME = 60;
2424

2525
/**
26+
* Processing object before save data
27+
*
2628
* @since 100.1.0
29+
* @throws LocalizedException
2730
*/
2831
public function beforeSave()
2932
{
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
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\Backend\Test\Unit\Service\V1;
9+
10+
use Magento\Backend\Service\V1\ModuleService;
11+
use Magento\Framework\Module\ModuleListInterface;
12+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
13+
14+
/**
15+
* Module List Service Test
16+
*
17+
* Covers \Magento\Sales\Model\ValidatorResultMerger
18+
*/
19+
class ModuleServiceTest extends \PHPUnit\Framework\TestCase
20+
{
21+
/**
22+
* Testable Object
23+
*
24+
* @var ModuleService
25+
*/
26+
private $moduleService;
27+
28+
/**
29+
* @var ModuleListInterface|\PHPUnit_Framework_MockObject_MockObject
30+
*/
31+
private $moduleListMock;
32+
33+
/**
34+
* Object Manager
35+
*
36+
* @var ObjectManager
37+
*/
38+
private $objectManager;
39+
40+
/**
41+
* Set Up
42+
*
43+
* @return void
44+
*/
45+
protected function setUp()
46+
{
47+
$this->moduleListMock = $this->createMock(ModuleListInterface::class);
48+
$this->objectManager = new ObjectManager($this);
49+
$this->moduleService = $this->objectManager->getObject(
50+
ModuleService::class,
51+
[
52+
'moduleList' => $this->moduleListMock,
53+
]
54+
);
55+
}
56+
57+
/**
58+
* Test getModules method
59+
*
60+
* @return void
61+
*/
62+
public function testGetModules()
63+
{
64+
$moduleNames = ['Magento_Backend', 'Magento_Catalog', 'Magento_Customer'];
65+
$this->moduleListMock->expects($this->once())->method('getNames')->willReturn($moduleNames);
66+
67+
$expected = $moduleNames;
68+
$actual = $this->moduleService->getModules();
69+
$this->assertEquals($expected, $actual);
70+
}
71+
}

app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main/Formgroup.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111

1212
use Magento\Backend\Block\Widget\Form;
1313

14+
/**
15+
* Form group for attribute set
16+
*/
1417
class Formgroup extends \Magento\Backend\Block\Widget\Form\Generic
1518
{
1619
/**
@@ -37,6 +40,8 @@ public function __construct(
3740
}
3841

3942
/**
43+
* Prepare form elements
44+
*
4045
* @return void
4146
*/
4247
protected function _prepareForm()
@@ -77,13 +82,15 @@ protected function _prepareForm()
7782
}
7883

7984
/**
85+
* Returns set id
86+
*
8087
* @return int
8188
*/
8289
protected function _getSetId()
8390
{
84-
return intval(
91+
return (int)(
8592
$this->getRequest()->getParam('id')
86-
) > 0 ? intval(
93+
) > 0 ? (int)(
8794
$this->getRequest()->getParam('id')
8895
) : $this->_typeFactory->create()->load(
8996
$this->_coreRegistry->registry('entityType')

app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -259,14 +259,14 @@ public function execute()
259259
$data['backend_model'] = $this->productHelper->getAttributeBackendModelByInputType(
260260
$data['frontend_input']
261261
);
262+
263+
if ($model->getIsUserDefined() === null) {
264+
$data['backend_type'] = $model->getBackendTypeByInput($data['frontend_input']);
265+
}
262266
}
263267

264268
$data += ['is_filterable' => 0, 'is_filterable_in_search' => 0];
265269

266-
if ($model->getIsUserDefined() === null || $model->getIsUserDefined() != 0) {
267-
$data['backend_type'] = $model->getBackendTypeByInput($data['frontend_input']);
268-
}
269-
270270
$defaultValueField = $model->getDefaultValueByInput($data['frontend_input']);
271271
if ($defaultValueField) {
272272
$data['default_value'] = $this->getRequest()->getParam($defaultValueField);

app/code/Magento/Catalog/Model/ProductLink/CollectionProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ public function getCollection(\Magento\Catalog\Model\Product $product, $type)
5858
}
5959

6060
usort($sorterItems, function ($itemA, $itemB) {
61-
$posA = intval($itemA['position']);
62-
$posB = intval($itemB['position']);
61+
$posA = (int)$itemA['position'];
62+
$posB = (int)$itemB['position'];
6363

6464
return $posA <=> $posB;
6565
});

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,7 @@ protected function getItemsPerPage()
806806
// Maximal Products limit
807807
$maxProductsLimit = 5000;
808808

809-
$this->_itemsPerPage = intval(
809+
$this->_itemsPerPage = (int)(
810810
($memoryLimit * $memoryUsagePercent - memory_get_usage(true)) / $memoryPerProduct
811811
);
812812
if ($this->_itemsPerPage < $minProductsLimit) {

app/code/Magento/Checkout/view/frontend/templates/cart/form.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<?php endif ?>
2525
<table id="shopping-cart-table"
2626
class="cart items data table"
27-
data-mage-init='{"shoppingCart":{"emptyCartButton": "action.clear",
27+
data-mage-init='{"shoppingCart":{"emptyCartButton": ".action.clear",
2828
"updateCartActionContainer": "#update_cart_action_container"}}'>
2929
<caption class="table-caption"><?= /* @escapeNotVerified */ __('Shopping Cart Items') ?></caption>
3030
<thead>

app/code/Magento/Config/Model/Config/Backend/Currency/Cron.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
namespace Magento\Config\Model\Config\Backend\Currency;
1111

1212
/**
13+
* Cron job configuration for currency
14+
*
1315
* @api
1416
* @since 100.0.2
1517
*/
@@ -47,6 +49,8 @@ public function __construct(
4749
}
4850

4951
/**
52+
* After save handler
53+
*
5054
* @return $this
5155
* @throws \Exception
5256
*/
@@ -59,8 +63,8 @@ public function afterSave()
5963
$frequencyMonthly = \Magento\Cron\Model\Config\Source\Frequency::CRON_MONTHLY;
6064

6165
$cronExprArray = [
62-
intval($time[1]), # Minute
63-
intval($time[0]), # Hour
66+
(int)$time[1], # Minute
67+
(int)$time[0], # Hour
6468
$frequency == $frequencyMonthly ? '1' : '*', # Day of the Month
6569
'*', # Month of the Year
6670
$frequency == $frequencyWeekly ? '1' : '*', # Day of the Week

app/code/Magento/Config/Model/Config/Backend/Log/Cron.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
namespace Magento\Config\Model\Config\Backend\Log;
1111

1212
/**
13+
* Cron logger configuration
14+
*
1315
* @api
1416
* @since 100.0.2
1517
*/
@@ -73,8 +75,8 @@ public function afterSave()
7375

7476
if ($enabled) {
7577
$cronExprArray = [
76-
intval($time[1]), # Minute
77-
intval($time[0]), # Hour
78+
(int)$time[1], # Minute
79+
(int)$time[0], # Hour
7880
$frequency == $frequencyMonthly ? '1' : '*', # Day of the Month
7981
'*', # Month of the Year
8082
$frequency == $frequencyWeekly ? '1' : '*', # Day of the Week

app/code/Magento/Cron/Model/Config/Backend/Product/Alert.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
*/
1212
namespace Magento\Cron\Model\Config\Backend\Product;
1313

14+
/**
15+
* Cron job Alert configuration
16+
*/
1417
class Alert extends \Magento\Framework\App\Config\Value
1518
{
1619
/**
@@ -61,7 +64,7 @@ public function __construct(
6164
}
6265

6366
/**
64-
* {@inheritdoc}
67+
* @inheritdoc
6568
*
6669
* @return $this
6770
* @throws \Exception
@@ -72,8 +75,8 @@ public function afterSave()
7275
$frequency = $this->getData('groups/productalert_cron/fields/frequency/value');
7376

7477
$cronExprArray = [
75-
intval($time[1]), //Minute
76-
intval($time[0]), //Hour
78+
(int)$time[1], //Minute
79+
(int)$time[0], //Hour
7780
$frequency == \Magento\Cron\Model\Config\Source\Frequency::CRON_MONTHLY ? '1' : '*', //Day of the Month
7881
'*', //Month of the Year
7982
$frequency == \Magento\Cron\Model\Config\Source\Frequency::CRON_WEEKLY ? '1' : '*', //Day of the Week

app/code/Magento/Cron/Model/Config/Backend/Sitemap.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
*/
1212
namespace Magento\Cron\Model\Config\Backend;
1313

14+
/**
15+
* Sitemap configuration
16+
*/
1417
class Sitemap extends \Magento\Framework\App\Config\Value
1518
{
1619
/**
@@ -61,6 +64,8 @@ public function __construct(
6164
}
6265

6366
/**
67+
* After save handler
68+
*
6469
* @return $this
6570
* @throws \Exception
6671
*/
@@ -70,8 +75,8 @@ public function afterSave()
7075
$frequency = $this->getData('groups/generate/fields/frequency/value');
7176

7277
$cronExprArray = [
73-
intval($time[1]), //Minute
74-
intval($time[0]), //Hour
78+
(int)$time[1], //Minute
79+
(int)$time[0], //Hour
7580
$frequency == \Magento\Cron\Model\Config\Source\Frequency::CRON_MONTHLY ? '1' : '*', //Day of the Month
7681
'*', //Month of the Year
7782
$frequency == \Magento\Cron\Model\Config\Source\Frequency::CRON_WEEKLY ? '1' : '*', //# Day of the Week

app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/PersonalInfo.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,12 @@ public function __construct(
152152
/**
153153
* Set customer registry
154154
*
155-
* @param \Magento\Framework\Registry $coreRegistry
155+
* @param \Magento\Framework\Registry $customerRegistry
156156
* @return void
157157
* @deprecated 100.1.0
158158
*/
159159
public function setCustomerRegistry(\Magento\Customer\Model\CustomerRegistry $customerRegistry)
160160
{
161-
162161
$this->customerRegistry = $customerRegistry;
163162
}
164163

@@ -461,7 +460,7 @@ protected function getOnlineMinutesInterval()
461460
'customer/online_customers/online_minutes_interval',
462461
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
463462
);
464-
return intval($configValue) > 0 ? intval($configValue) : self::DEFAULT_ONLINE_MINUTES_INTERVAL;
463+
return (int)$configValue > 0 ? (int)$configValue : self::DEFAULT_ONLINE_MINUTES_INTERVAL;
465464
}
466465

467466
/**

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ public function __construct(
122122
}
123123

124124
/**
125+
* Init model
126+
*
125127
* @return void
126128
*/
127129
protected function _construct()
@@ -154,9 +156,6 @@ public function updateData(AddressInterface $address)
154156
// Need to explicitly set this due to discrepancy in the keys between model and data object
155157
$this->setIsDefaultBilling($address->isDefaultBilling());
156158
$this->setIsDefaultShipping($address->isDefaultShipping());
157-
if (!$this->getAttributeSetId()) {
158-
$this->setAttributeSetId(AddressMetadataInterface::ATTRIBUTE_SET_ID_ADDRESS);
159-
}
160159
$customAttributes = $address->getCustomAttributes();
161160
if ($customAttributes !== null) {
162161
foreach ($customAttributes as $attribute) {
@@ -168,7 +167,7 @@ public function updateData(AddressInterface $address)
168167
}
169168

170169
/**
171-
* {@inheritdoc}
170+
* @inheritdoc
172171
*/
173172
public function getDataModel($defaultBillingAddressId = null, $defaultShippingAddressId = null)
174173
{
@@ -261,6 +260,8 @@ public function getDefaultAttributeCodes()
261260
}
262261

263262
/**
263+
* Clone object handler
264+
*
264265
* @return void
265266
*/
266267
public function __clone()
@@ -301,6 +302,8 @@ public function setRegionId($regionId)
301302
}
302303

303304
/**
305+
* Create customer model
306+
*
304307
* @return Customer
305308
*/
306309
protected function _createCustomer()
@@ -356,7 +359,7 @@ public function reindex()
356359
}
357360

358361
/**
359-
* {@inheritdoc}
362+
* @inheritdoc
360363
* @since 100.0.6
361364
*/
362365
protected function getCustomAttributesCodes()
@@ -366,6 +369,7 @@ protected function getCustomAttributesCodes()
366369

367370
/**
368371
* Get new AttributeList dependency for application code.
372+
*
369373
* @return \Magento\Customer\Model\Address\CustomAttributeListInterface
370374
* @deprecated 100.0.6
371375
*/

0 commit comments

Comments
 (0)