Skip to content

Commit

Permalink
🔃 [EngCom] Public Pull Requests - 2.3-develop
Browse files Browse the repository at this point in the history
Accepted Public Pull Requests:
 - magento#18573: Update documentation for Order#getAppliedRuleIds (by @zack6849)
 - magento#18638: [Forwardport] Calendar icon in advance pricing alignment solved (by @speedy008)
 - magento#18608: Replace intval() function by using direct type casting to (int) (by @mage2pratik)
 - magento#18596: Fix empty cart button (by @luukschakenraad)
 - magento#18600: Fix the typo in PHPDoc comment (by @dmytro-ch)
 - magento#18571: [Forwardport] Fix Customer custom attributes lost after save (by @gelanivishal)
 - magento#18570: [Forwardport] Fix for custom product attribute changing 'backend_type' when 'is_use� (by @gelanivishal)
 - magento#18546: Backend: add missing unit test for ModuleService class (by @dmytro-ch)
 - magento#17800: Updating error message for misleading error in add product attribute code (by @aman3103)


Fixed GitHub Issues:
 - magento#18581: Calendar Icon aligement Issue  (reported by @jignesh26) has been fixed in magento#18638 by @speedy008 in 2.3-develop branch
   Related commits:
     1. 039c88d

 - magento#18475: "Clear Shopping Cart" in Magento Blank theme no longer working after 2.2.6 (reported by @dewayneholden) has been fixed in magento#18596 by @luukschakenraad in 2.3-develop branch
   Related commits:
     1. cc3835f

 - magento#18589: Empty cart button does not work (reported by @luukschakenraad) has been fixed in magento#18596 by @luukschakenraad in 2.3-develop branch
   Related commits:
     1. cc3835f

 - magento#12479: Saving Customer Model directly causes loss of data (reported by @Danielc3) has been fixed in magento#18571 by @gelanivishal in 2.3-develop branch
   Related commits:
     1. 2322baf
     2. ce82c5c
     3. 9707676

 - magento#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 magento#18570 by @gelanivishal in 2.3-develop branch
   Related commits:
     1. 40e128c

 - magento#17754: Misleading error in Add Product Attribute screen (reported by @milossh) has been fixed in magento#17800 by @aman3103 in 2.3-develop branch
   Related commits:
     1. 9aa4cfa
     2. 18e509c
     3. 9a15e1f
     4. 6a0485f
     5. b6a899f
  • Loading branch information
slavvka authored Oct 22, 2018
2 parents f710f9b + 818fa86 commit 7fc1ef6
Show file tree
Hide file tree
Showing 49 changed files with 324 additions and 117 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,17 @@
*/
class BackendModel extends Value
{
/** Maximum dmin session lifetime; 1 year*/
/** Maximum admin session lifetime; 1 year*/
const MAX_LIFETIME = 31536000;

/** Minimum admin session lifetime */
const MIN_LIFETIME = 60;

/**
* Processing object before save data
*
* @since 100.1.0
* @throws LocalizedException
*/
public function beforeSave()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\Backend\Test\Unit\Service\V1;

use Magento\Backend\Service\V1\ModuleService;
use Magento\Framework\Module\ModuleListInterface;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;

/**
* Module List Service Test
*
* Covers \Magento\Sales\Model\ValidatorResultMerger
*/
class ModuleServiceTest extends \PHPUnit\Framework\TestCase
{
/**
* Testable Object
*
* @var ModuleService
*/
private $moduleService;

/**
* @var ModuleListInterface|\PHPUnit_Framework_MockObject_MockObject
*/
private $moduleListMock;

/**
* Object Manager
*
* @var ObjectManager
*/
private $objectManager;

/**
* Set Up
*
* @return void
*/
protected function setUp()
{
$this->moduleListMock = $this->createMock(ModuleListInterface::class);
$this->objectManager = new ObjectManager($this);
$this->moduleService = $this->objectManager->getObject(
ModuleService::class,
[
'moduleList' => $this->moduleListMock,
]
);
}

/**
* Test getModules method
*
* @return void
*/
public function testGetModules()
{
$moduleNames = ['Magento_Backend', 'Magento_Catalog', 'Magento_Customer'];
$this->moduleListMock->expects($this->once())->method('getNames')->willReturn($moduleNames);

$expected = $moduleNames;
$actual = $this->moduleService->getModules();
$this->assertEquals($expected, $actual);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@

use Magento\Backend\Block\Widget\Form;

/**
* Form group for attribute set
*/
class Formgroup extends \Magento\Backend\Block\Widget\Form\Generic
{
/**
Expand All @@ -37,6 +40,8 @@ public function __construct(
}

/**
* Prepare form elements
*
* @return void
*/
protected function _prepareForm()
Expand Down Expand Up @@ -77,13 +82,15 @@ protected function _prepareForm()
}

/**
* Returns set id
*
* @return int
*/
protected function _getSetId()
{
return intval(
return (int)(
$this->getRequest()->getParam('id')
) > 0 ? intval(
) > 0 ? (int)(
$this->getRequest()->getParam('id')
) : $this->_typeFactory->create()->load(
$this->_coreRegistry->registry('entityType')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,14 +259,14 @@ public function execute()
$data['backend_model'] = $this->productHelper->getAttributeBackendModelByInputType(
$data['frontend_input']
);

if ($model->getIsUserDefined() === null) {
$data['backend_type'] = $model->getBackendTypeByInput($data['frontend_input']);
}
}

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

if ($model->getIsUserDefined() === null || $model->getIsUserDefined() != 0) {
$data['backend_type'] = $model->getBackendTypeByInput($data['frontend_input']);
}

$defaultValueField = $model->getDefaultValueByInput($data['frontend_input']);
if ($defaultValueField) {
$data['default_value'] = $this->getRequest()->getParam($defaultValueField);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ public function getCollection(\Magento\Catalog\Model\Product $product, $type)
}

usort($sorterItems, function ($itemA, $itemB) {
$posA = intval($itemA['position']);
$posB = intval($itemB['position']);
$posA = (int)$itemA['position'];
$posB = (int)$itemB['position'];

return $posA <=> $posB;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ protected function getItemsPerPage()
// Maximal Products limit
$maxProductsLimit = 5000;

$this->_itemsPerPage = intval(
$this->_itemsPerPage = (int)(
($memoryLimit * $memoryUsagePercent - memory_get_usage(true)) / $memoryPerProduct
);
if ($this->_itemsPerPage < $minProductsLimit) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<?php endif ?>
<table id="shopping-cart-table"
class="cart items data table"
data-mage-init='{"shoppingCart":{"emptyCartButton": "action.clear",
data-mage-init='{"shoppingCart":{"emptyCartButton": ".action.clear",
"updateCartActionContainer": "#update_cart_action_container"}}'>
<caption class="table-caption"><?= /* @escapeNotVerified */ __('Shopping Cart Items') ?></caption>
<thead>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
namespace Magento\Config\Model\Config\Backend\Currency;

/**
* Cron job configuration for currency
*
* @api
* @since 100.0.2
*/
Expand Down Expand Up @@ -47,6 +49,8 @@ public function __construct(
}

/**
* After save handler
*
* @return $this
* @throws \Exception
*/
Expand All @@ -59,8 +63,8 @@ public function afterSave()
$frequencyMonthly = \Magento\Cron\Model\Config\Source\Frequency::CRON_MONTHLY;

$cronExprArray = [
intval($time[1]), # Minute
intval($time[0]), # Hour
(int)$time[1], # Minute
(int)$time[0], # Hour
$frequency == $frequencyMonthly ? '1' : '*', # Day of the Month
'*', # Month of the Year
$frequency == $frequencyWeekly ? '1' : '*', # Day of the Week
Expand Down
6 changes: 4 additions & 2 deletions app/code/Magento/Config/Model/Config/Backend/Log/Cron.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
namespace Magento\Config\Model\Config\Backend\Log;

/**
* Cron logger configuration
*
* @api
* @since 100.0.2
*/
Expand Down Expand Up @@ -73,8 +75,8 @@ public function afterSave()

if ($enabled) {
$cronExprArray = [
intval($time[1]), # Minute
intval($time[0]), # Hour
(int)$time[1], # Minute
(int)$time[0], # Hour
$frequency == $frequencyMonthly ? '1' : '*', # Day of the Month
'*', # Month of the Year
$frequency == $frequencyWeekly ? '1' : '*', # Day of the Week
Expand Down
9 changes: 6 additions & 3 deletions app/code/Magento/Cron/Model/Config/Backend/Product/Alert.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
*/
namespace Magento\Cron\Model\Config\Backend\Product;

/**
* Cron job Alert configuration
*/
class Alert extends \Magento\Framework\App\Config\Value
{
/**
Expand Down Expand Up @@ -61,7 +64,7 @@ public function __construct(
}

/**
* {@inheritdoc}
* @inheritdoc
*
* @return $this
* @throws \Exception
Expand All @@ -72,8 +75,8 @@ public function afterSave()
$frequency = $this->getData('groups/productalert_cron/fields/frequency/value');

$cronExprArray = [
intval($time[1]), //Minute
intval($time[0]), //Hour
(int)$time[1], //Minute
(int)$time[0], //Hour
$frequency == \Magento\Cron\Model\Config\Source\Frequency::CRON_MONTHLY ? '1' : '*', //Day of the Month
'*', //Month of the Year
$frequency == \Magento\Cron\Model\Config\Source\Frequency::CRON_WEEKLY ? '1' : '*', //Day of the Week
Expand Down
9 changes: 7 additions & 2 deletions app/code/Magento/Cron/Model/Config/Backend/Sitemap.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
*/
namespace Magento\Cron\Model\Config\Backend;

/**
* Sitemap configuration
*/
class Sitemap extends \Magento\Framework\App\Config\Value
{
/**
Expand Down Expand Up @@ -61,6 +64,8 @@ public function __construct(
}

/**
* After save handler
*
* @return $this
* @throws \Exception
*/
Expand All @@ -70,8 +75,8 @@ public function afterSave()
$frequency = $this->getData('groups/generate/fields/frequency/value');

$cronExprArray = [
intval($time[1]), //Minute
intval($time[0]), //Hour
(int)$time[1], //Minute
(int)$time[0], //Hour
$frequency == \Magento\Cron\Model\Config\Source\Frequency::CRON_MONTHLY ? '1' : '*', //Day of the Month
'*', //Month of the Year
$frequency == \Magento\Cron\Model\Config\Source\Frequency::CRON_WEEKLY ? '1' : '*', //# Day of the Week
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,12 @@ public function __construct(
/**
* Set customer registry
*
* @param \Magento\Framework\Registry $coreRegistry
* @param \Magento\Framework\Registry $customerRegistry
* @return void
* @deprecated 100.1.0
*/
public function setCustomerRegistry(\Magento\Customer\Model\CustomerRegistry $customerRegistry)
{

$this->customerRegistry = $customerRegistry;
}

Expand Down Expand Up @@ -461,7 +460,7 @@ protected function getOnlineMinutesInterval()
'customer/online_customers/online_minutes_interval',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
return intval($configValue) > 0 ? intval($configValue) : self::DEFAULT_ONLINE_MINUTES_INTERVAL;
return (int)$configValue > 0 ? (int)$configValue : self::DEFAULT_ONLINE_MINUTES_INTERVAL;
}

/**
Expand Down
14 changes: 9 additions & 5 deletions app/code/Magento/Customer/Model/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ public function __construct(
}

/**
* Init model
*
* @return void
*/
protected function _construct()
Expand Down Expand Up @@ -154,9 +156,6 @@ public function updateData(AddressInterface $address)
// Need to explicitly set this due to discrepancy in the keys between model and data object
$this->setIsDefaultBilling($address->isDefaultBilling());
$this->setIsDefaultShipping($address->isDefaultShipping());
if (!$this->getAttributeSetId()) {
$this->setAttributeSetId(AddressMetadataInterface::ATTRIBUTE_SET_ID_ADDRESS);
}
$customAttributes = $address->getCustomAttributes();
if ($customAttributes !== null) {
foreach ($customAttributes as $attribute) {
Expand All @@ -168,7 +167,7 @@ public function updateData(AddressInterface $address)
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function getDataModel($defaultBillingAddressId = null, $defaultShippingAddressId = null)
{
Expand Down Expand Up @@ -261,6 +260,8 @@ public function getDefaultAttributeCodes()
}

/**
* Clone object handler
*
* @return void
*/
public function __clone()
Expand Down Expand Up @@ -301,6 +302,8 @@ public function setRegionId($regionId)
}

/**
* Create customer model
*
* @return Customer
*/
protected function _createCustomer()
Expand Down Expand Up @@ -356,7 +359,7 @@ public function reindex()
}

/**
* {@inheritdoc}
* @inheritdoc
* @since 100.0.6
*/
protected function getCustomAttributesCodes()
Expand All @@ -366,6 +369,7 @@ protected function getCustomAttributesCodes()

/**
* Get new AttributeList dependency for application code.
*
* @return \Magento\Customer\Model\Address\CustomAttributeListInterface
* @deprecated 100.0.6
*/
Expand Down
Loading

0 comments on commit 7fc1ef6

Please sign in to comment.