Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit 20f1162

Browse files
authored
🔃 [EngCom] Public Pull Requests - 2.3-develop
Accepted Public Pull Requests: - magento/magento2#18290: Fix wrong reference in google analytics module layout xml (by @sambolek) - magento/magento2#18149: type casted $qty to float in \Magento\Catalog\Model\Product::setQty() (by @jayankaghosh) - magento/magento2#18273: [Forwardport] Correctly convert config integration api resources (by @mage2pratik) - magento/magento2#18173: Use version_compare to compare version strings correctly (by @schmengler) - magento/magento2#18272: [Forwardport] 9830 - Null order in Magento\Sales\Block\Order\PrintShipment.php (by @mage2pratik) - magento/magento2#18244: Don't set a source model on the attribute when it's not needed. This � (by @hostep) - magento/magento2#18231: [Forwardport] Update shipment collection to unserialize `packages` attribute after load (by @mage2pratik) - magento/magento2#18228: [Forwardport] Fix sitemap grid render incorrect base urls for multiple stores (by @nntoan) - magento/magento2#18212: Allow keyboard navigation in browser on product detail pages, by fixi� (by @hostep) - magento/magento2#18201: [Forwardport] Allow usage of config-global.php when running Integration Tests (by @mage2pratik) - magento/magento2#18334: [Forwardport] Integration test for swatches types in attribute configuration added (by @jignesh-baldha) - magento/magento2#18288: Fix issue 17152 - prevent email being marked as not sent if email cop� (by @sambolek) - magento/magento2#18331: Fix throwing error by checkout error processor model (by @ihor-sviziev) - magento/magento2#18322: Fix for removing the dirs while creating a TAR archive (by @haroldclaus) - magento/magento2#18308: Fix the issue with customer inline edit when password is expired (by @dmytro-ch) - magento/magento2#18312: [Forwardport] fix: reset search mini-form when we have no data / an empty response (by @dmytro-ch) - magento/magento2#18292: Do not use new Phrase in Link Current class (by @VincentMarmiesse) - magento/magento2#18209: Introducing a dedicated cron.log file for logging cron related info, � (by @hostep) - magento/magento2#18303: [Forwardport] Cast products getStoreId() to int (by @sreichel) - magento/magento2#18295: [Forwardport] fix #17582 ./bin/magento config:show fails with a fatal error (by @mage2pratik) - magento/magento2#18064: Fixing Snake Case To Camel Case (by @hryvinskyi) - magento/magento2#18344: Added unit test for CRON converter plugin (by @rogyar) Fixed GitHub Issues: - magento/magento2#16497: Magento 2.2.5: Google Analytics not added to head correctly (reported by @WalterSmulders) has been fixed in magento/magento2#18290 by @sambolek in 2.3-develop branch Related commits: 1. f6fcf41 - magento/magento2#18094: Should getQty() return int/float or string? (reported by @sreichel) has been fixed in magento/magento2#18149 by @jayankaghosh in 2.3-develop branch Related commits: 1. 76676ce 2. 2ad1031 - magento/magento2#12095: Update 2.2.1: One or more integrations have been reset because of a change to their xml configs. (reported by @thomvanderboon) has been fixed in magento/magento2#18273 by @mage2pratik in 2.3-develop branch Related commits: 1. 6c33d20 2. 0b3fe71 3. 31b7f07 4. 999d8e5 5. 401b423 - magento/magento2#9830: Null order in Magento\Sales\Block\Order\PrintShipment.php (reported by @dnadle) has been fixed in magento/magento2#18272 by @mage2pratik in 2.3-develop branch Related commits: 1. 37ff9e9 - magento/magento2#10530: Print order error on magento 2.1.8 (reported by @ionutdicu) has been fixed in magento/magento2#18272 by @mage2pratik in 2.3-develop branch Related commits: 1. 37ff9e9 - magento/magento2#13156: Updating attribute option data through API will set unwanted source_model on the attribute (reported by @koenner01) has been fixed in magento/magento2#18244 by @hostep in 2.3-develop branch Related commits: 1. 477ca51 - magento/magento2#17999: Sitemap grid display incorrect base URL in the grid if using multiple stores (reported by @nntoan) has been fixed in magento/magento2#18228 by @nntoan in 2.3-develop branch Related commits: 1. 5144320 - magento/magento2#15196: 2.2.4 : Magento 2 integration tests enables all modules (reported by @kanduvisla) has been fixed in magento/magento2#18201 by @mage2pratik in 2.3-develop branch Related commits: 1. 0d0b5c0 2. 81076e1 3. 421ba0b 4. c0cb405 5. 99b1ca7 - magento/magento2#17152: Failure of "Send Order Email Copy" spams customers, every minute, forever. (reported by @lingwooc) has been fixed in magento/magento2#18288 by @sambolek in 2.3-develop branch Related commits: 1. 5548c9d 2. 8c8b0a8 3. 6fe9303 - magento/magento2#18330: Checkout - Infinite loading indicator when server returned error (reported by @ihor-sviziev) has been fixed in magento/magento2#18331 by @ihor-sviziev in 2.3-develop branch Related commits: 1. eea11c7 - magento/magento2#18162: Cannot edit customer using inline edit if password is expired (reported by @JeroenVanLeusden) has been fixed in magento/magento2#18308 by @dmytro-ch in 2.3-develop branch Related commits: 1. 2eeb65c 2. 34830c6 - magento/magento2#17190: system.log rapidly increasing after Magento CE 2.2.5 update (cron logs) (reported by @mad-develop) has been fixed in magento/magento2#18209 by @hostep in 2.3-develop branch Related commits: 1. a4f58c8 - magento/magento2#18079: Inconsistent return type for getStoreId() (reported by @sreichel) has been fixed in magento/magento2#18303 by @sreichel in 2.3-develop branch Related commits: 1. 5411c0d - magento/magento2#17582: ./bin/magento config:show fails with a fatal error (reported by @simonworkhouse) has been fixed in magento/magento2#18295 by @mage2pratik in 2.3-develop branch Related commits: 1. 20af5a9
2 parents da5a9ed + 9d3b612 commit 20f1162

File tree

34 files changed

+519
-147
lines changed

34 files changed

+519
-147
lines changed

app/code/Magento/Catalog/Model/Category.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements
7272

7373
const CACHE_TAG = 'cat_c';
7474

75+
/**
76+
* Category Store Id
77+
*/
78+
const STORE_ID = 'store_id';
79+
7580
/**#@-*/
7681
protected $_eventPrefix = 'catalog_category';
7782

@@ -564,12 +569,12 @@ public function getStoreIds()
564569
*
565570
* If store id is underfined for category return current active store id
566571
*
567-
* @return integer
572+
* @return int
568573
*/
569574
public function getStoreId()
570575
{
571-
if ($this->hasData('store_id')) {
572-
return (int)$this->_getData('store_id');
576+
if ($this->hasData(self::STORE_ID)) {
577+
return (int)$this->_getData(self::STORE_ID);
573578
}
574579
return (int)$this->_storeManager->getStore()->getId();
575580
}
@@ -585,7 +590,7 @@ public function setStoreId($storeId)
585590
if (!is_numeric($storeId)) {
586591
$storeId = $this->_storeManager->getStore($storeId)->getId();
587592
}
588-
$this->setData('store_id', $storeId);
593+
$this->setData(self::STORE_ID, $storeId);
589594
$this->getResource()->setStoreId($storeId);
590595
return $this;
591596
}

app/code/Magento/Catalog/Model/Product.php

Lines changed: 43 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -498,8 +498,9 @@ protected function _getResource()
498498
}
499499

500500
/**
501-
* Get a list of custom attribute codes that belongs to product attribute set. If attribute set not specified for
502-
* product will return all product attribute codes
501+
* Get a list of custom attribute codes that belongs to product attribute set.
502+
*
503+
* If attribute set not specified for product will return all product attribute codes
503504
*
504505
* @return string[]
505506
*/
@@ -526,9 +527,9 @@ protected function getCustomAttributesCodes()
526527
public function getStoreId()
527528
{
528529
if ($this->hasData(self::STORE_ID)) {
529-
return $this->getData(self::STORE_ID);
530+
return (int)$this->getData(self::STORE_ID);
530531
}
531-
return $this->_storeManager->getStore()->getId();
532+
return (int)$this->_storeManager->getStore()->getId();
532533
}
533534

534535
/**
@@ -584,8 +585,9 @@ public function getPrice()
584585
}
585586

586587
/**
587-
* @codeCoverageIgnoreStart
588588
* Get visibility status
589+
*
590+
* @codeCoverageIgnoreStart
589591
* @see \Magento\Catalog\Model\Product\Visibility
590592
*
591593
* @return int
@@ -662,6 +664,7 @@ public function getStatus()
662664

663665
/**
664666
* Retrieve type instance of the product.
667+
*
665668
* Type instance implements product type depended logic and is a singleton shared by all products of the same type.
666669
*
667670
* @return \Magento\Catalog\Model\Product\Type\AbstractType
@@ -822,9 +825,10 @@ public function getStoreIds()
822825

823826
/**
824827
* Retrieve product attributes
825-
* if $groupId is null - retrieve all product attributes
826828
*
827-
* @param int $groupId Retrieve attributes of the specified group
829+
* If $groupId is null - retrieve all product attributes
830+
*
831+
* @param int $groupId Retrieve attributes of the specified group
828832
* @param bool $skipSuper Not used
829833
* @return \Magento\Eav\Model\Entity\Attribute\AbstractAttribute[]
830834
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
@@ -916,6 +920,7 @@ public function beforeSave()
916920

917921
/**
918922
* Check/set if options can be affected when saving product
923+
*
919924
* If value specified, it will be set.
920925
*
921926
* @param bool $value
@@ -976,7 +981,7 @@ public function setQty($qty)
976981
*/
977982
public function getQty()
978983
{
979-
return $this->getData('qty');
984+
return (float)$this->getData('qty');
980985
}
981986

982987
/**
@@ -1036,6 +1041,7 @@ public function reindex()
10361041

10371042
/**
10381043
* Clear cache related with product and protect delete from not admin
1044+
*
10391045
* Register indexing event before delete product
10401046
*
10411047
* @return \Magento\Catalog\Model\Product
@@ -1545,11 +1551,11 @@ public function hasGalleryAttribute()
15451551
/**
15461552
* Add image to media gallery
15471553
*
1548-
* @param string $file file path of image in file system
1549-
* @param string|array $mediaAttribute code of attribute with type 'media_image',
1550-
* leave blank if image should be only in gallery
1551-
* @param boolean $move if true, it will move source file
1552-
* @param boolean $exclude mark image as disabled in product page view
1554+
* @param string $file file path of image in file system
1555+
* @param string|array $mediaAttribute code of attribute with type 'media_image',
1556+
* leave blank if image should be only in gallery
1557+
* @param bool $move if true, it will move source file
1558+
* @param bool $exclude mark image as disabled in product page view
15531559
* @return \Magento\Catalog\Model\Product
15541560
*/
15551561
public function addImageToMediaGallery($file, $mediaAttribute = null, $move = false, $exclude = true)
@@ -1711,6 +1717,7 @@ public function getIsSalable()
17111717

17121718
/**
17131719
* Check is a virtual product
1720+
*
17141721
* Data helper wrapper
17151722
*
17161723
* @return bool
@@ -1803,9 +1810,9 @@ public function formatUrlKey($str)
18031810
/**
18041811
* Save current attribute with code $code and assign new value
18051812
*
1806-
* @param string $code Attribute code
1807-
* @param mixed $value New attribute value
1808-
* @param int $store Store ID
1813+
* @param string $code Attribute code
1814+
* @param mixed $value New attribute value
1815+
* @param int $store Store ID
18091816
* @return void
18101817
*/
18111818
public function addAttributeUpdate($code, $value, $store)
@@ -1875,6 +1882,7 @@ public function getRequestPath()
18751882

18761883
/**
18771884
* Custom function for other modules
1885+
*
18781886
* @return string
18791887
*/
18801888
public function getGiftMessageAvailable()
@@ -1993,6 +2001,8 @@ public function getOptions()
19932001
}
19942002

19952003
/**
2004+
* Set product options
2005+
*
19962006
* @param \Magento\Catalog\Api\Data\ProductCustomOptionInterface[] $options
19972007
* @return $this
19982008
*/
@@ -2016,10 +2026,10 @@ public function getIsVirtual()
20162026
/**
20172027
* Add custom option information to product
20182028
*
2019-
* @param string $code Option code
2020-
* @param mixed $value Value of the option
2021-
* @param int|Product $product Product ID
2022-
* @return $this
2029+
* @param string $code Option code
2030+
* @param mixed $value Value of the option
2031+
* @param int|Product $product Product ID
2032+
* @return $this
20232033
*/
20242034
public function addCustomOption($code, $value, $product = null)
20252035
{
@@ -2213,6 +2223,7 @@ public function getPreconfiguredValues()
22132223

22142224
/**
22152225
* Prepare product custom options.
2226+
*
22162227
* To be sure that all product custom options does not has ID and has product instance
22172228
*
22182229
* @return \Magento\Catalog\Model\Product
@@ -2547,7 +2558,7 @@ public function setTypeId($typeId)
25472558
}
25482559

25492560
/**
2550-
* {@inheritdoc}
2561+
* @inheritdoc
25512562
*
25522563
* @return \Magento\Catalog\Api\Data\ProductExtensionInterface
25532564
*/
@@ -2557,7 +2568,7 @@ public function getExtensionAttributes()
25572568
}
25582569

25592570
/**
2560-
* {@inheritdoc}
2571+
* @inheritdoc
25612572
*
25622573
* @param \Magento\Catalog\Api\Data\ProductExtensionInterface $extensionAttributes
25632574
* @return $this
@@ -2570,6 +2581,8 @@ public function setExtensionAttributes(\Magento\Catalog\Api\Data\ProductExtensio
25702581
//@codeCoverageIgnoreEnd
25712582

25722583
/**
2584+
* Convert array to media gallery interface
2585+
*
25732586
* @param array $mediaGallery
25742587
* @return \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface[]
25752588
*/
@@ -2587,6 +2600,8 @@ protected function convertToMediaGalleryInterface(array $mediaGallery)
25872600
}
25882601

25892602
/**
2603+
* Returns media gallery entries
2604+
*
25902605
* @return \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface[]|null
25912606
*/
25922607
public function getMediaGalleryEntries()
@@ -2601,6 +2616,8 @@ public function getMediaGalleryEntries()
26012616
}
26022617

26032618
/**
2619+
* Set media gallery entries
2620+
*
26042621
* @param ProductAttributeMediaGalleryEntryInterface[] $mediaGalleryEntries
26052622
* @return $this
26062623
*/
@@ -2643,6 +2660,8 @@ public function setId($value)
26432660
}
26442661

26452662
/**
2663+
* Returns link repository instance
2664+
*
26462665
* @return ProductLinkRepositoryInterface
26472666
*/
26482667
private function getLinkRepository()
@@ -2655,6 +2674,8 @@ private function getLinkRepository()
26552674
}
26562675

26572676
/**
2677+
* Returns media gallery processor instance
2678+
*
26582679
* @return Product\Gallery\Processor
26592680
*/
26602681
private function getMediaGalleryProcessor()

app/code/Magento/Checkout/view/frontend/web/js/model/error-processor.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
*/
99
define([
1010
'mage/url',
11-
'Magento_Ui/js/model/messageList'
12-
], function (url, globalMessageList) {
11+
'Magento_Ui/js/model/messageList',
12+
'consoleLogger'
13+
], function (url, globalMessageList, consoleLogger) {
1314
'use strict';
1415

1516
return {
@@ -25,8 +26,12 @@ define([
2526
if (response.status == 401) { //eslint-disable-line eqeqeq
2627
window.location.replace(url.build('customer/account/login/'));
2728
} else {
28-
error = JSON.parse(response.responseText);
29-
messageContainer.addErrorMessage(error);
29+
try {
30+
error = JSON.parse(response.responseText);
31+
messageContainer.addErrorMessage(error);
32+
} catch (e) {
33+
consoleLogger.error(e);
34+
}
3035
}
3136
}
3237
};

app/code/Magento/Config/Console/Command/ConfigShow/ValueProcessor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function process($scope, $scopeCode, $value, $path)
9797
$field = $configStructure->getElementByConfigPath($path);
9898

9999
/** @var Value $backendModel */
100-
$backendModel = $field && $field->hasBackendModel()
100+
$backendModel = $field instanceof Field && $field->hasBackendModel()
101101
? $field->getBackendModel()
102102
: $this->configValueFactory->create();
103103

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
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\Cron\Test\Unit\Model\System\Config\Initial;
9+
10+
use Magento\Cron\Model\Groups\Config\Data as GroupsConfigModel;
11+
use Magento\Cron\Model\System\Config\Initial\Converter as ConverterPlugin;
12+
use Magento\Framework\App\Config\Initial\Converter;
13+
14+
/**
15+
* Class ConverterTest
16+
*
17+
* Unit test for \Magento\Cron\Model\System\Config\Initial\Converter
18+
*/
19+
class ConverterTest extends \PHPUnit\Framework\TestCase
20+
{
21+
/**
22+
* @var GroupsConfigModel|\PHPUnit_Framework_MockObject_MockObject
23+
*/
24+
private $groupsConfigMock;
25+
26+
/**
27+
* @var Converter|\PHPUnit_Framework_MockObject_MockObject
28+
*/
29+
private $converterMock;
30+
31+
/**
32+
* @var ConverterPlugin
33+
*/
34+
private $converterPlugin;
35+
36+
/**
37+
* @inheritdoc
38+
*/
39+
protected function setUp()
40+
{
41+
$this->groupsConfigMock = $this->getMockBuilder(
42+
GroupsConfigModel::class
43+
)->disableOriginalConstructor()->getMock();
44+
$this->converterMock = $this->getMockBuilder(Converter::class)->getMock();
45+
$this->converterPlugin = new ConverterPlugin($this->groupsConfigMock);
46+
}
47+
48+
/**
49+
* Tests afterConvert method with no $result['data']['default']['system'] set
50+
*/
51+
public function testAfterConvertWithNoData()
52+
{
53+
$expectedResult = ['test'];
54+
$this->groupsConfigMock->expects($this->never())
55+
->method('get');
56+
57+
$result = $this->converterPlugin->afterConvert($this->converterMock, $expectedResult);
58+
59+
self::assertSame($expectedResult, $result);
60+
}
61+
62+
/**
63+
* Tests afterConvert method with $result['data']['default']['system'] set
64+
*/
65+
public function testAfterConvertWithData()
66+
{
67+
$groups = [
68+
'group1' => ['val1' => ['value' => '1']],
69+
'group2' => ['val2' => ['value' => '2']]
70+
];
71+
$expectedResult['data']['default']['system']['cron'] = [
72+
'group1' => [
73+
'val1' => '1'
74+
],
75+
'group2' => [
76+
'val2' => '2'
77+
]
78+
];
79+
$result['data']['default']['system']['cron'] = '1';
80+
81+
$this->groupsConfigMock->expects($this->once())
82+
->method('get')
83+
->willReturn($groups);
84+
85+
$result = $this->converterPlugin->afterConvert($this->converterMock, $result);
86+
87+
self::assertEquals($expectedResult, $result);
88+
}
89+
}

0 commit comments

Comments
 (0)