Skip to content

Commit 845e53b

Browse files
authored
Merge branch '2.4-develop' into graphql-api-enhancements
2 parents f94245f + d550808 commit 845e53b

File tree

13 files changed

+98
-75
lines changed

13 files changed

+98
-75
lines changed

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

+3-1
Original file line numberDiff line numberDiff line change
@@ -2362,7 +2362,9 @@ public function addMediaGalleryData()
23622362
return $this;
23632363
}
23642364

2365-
if (!$this->getSize()) {
2365+
$size = $this->isLoaded() ? $this->count() : $this->getSize();
2366+
2367+
if (!$size) {
23662368
return $this;
23672369
}
23682370

app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Product/CollectionTest.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2015 Adobe
4+
* All Rights Reserved.
55
*/
66
declare(strict_types=1);
77

@@ -311,7 +311,6 @@ public function testAddMediaGalleryData()
311311
$this->metadataPoolMock->expects($this->once())->method('getMetadata')->willReturn($metadataMock);
312312
$metadataMock->expects($this->once())->method('getLinkField')->willReturn($linkField);
313313

314-
$this->connectionMock->expects($this->once())->method('fetchOne')->with($selectMock)->willReturn(42);
315314
$this->connectionMock->expects($this->once())->method('fetchAll')->with($selectMock)->willReturn(
316315
[['row_id' => $rowId]]
317316
);
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
2-
* Copyright © Magento, Inc. All rights reserved.
3-
* See COPYING.txt for license details.
2+
* Copyright 2019 Adobe
3+
* All Rights Reserved.
44
*/
55

66
var config = {
@@ -10,7 +10,8 @@ var config = {
1010
priceOptionDate: 'Magento_Catalog/js/price-option-date',
1111
priceOptionFile: 'Magento_Catalog/js/price-option-file',
1212
priceOptions: 'Magento_Catalog/js/price-options',
13-
priceUtils: 'Magento_Catalog/js/price-utils'
13+
priceUtils: 'Magento_Catalog/js/price-utils',
14+
catalogAddToCart: 'Magento_Catalog/js/catalog-add-to-cart'
1415
}
1516
}
1617
};

app/code/Magento/Catalog/view/frontend/web/js/validate-product.js renamed to app/code/Magento/Catalog/view/base/web/js/validate-product.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
2-
* Copyright © Magento, Inc. All rights reserved.
3-
* See COPYING.txt for license details.
2+
* Copyright 2016 Adobe
3+
* All Rights Reserved.
44
*/
55
define([
66
'jquery',

app/code/Magento/Catalog/view/frontend/requirejs-config.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
2-
* Copyright © Magento, Inc. All rights reserved.
3-
* See COPYING.txt for license details.
2+
* Copyright 2011 Adobe
3+
* All Rights Reserved.
44
*/
55

66
var config = {
@@ -10,8 +10,7 @@ var config = {
1010
relatedProducts: 'Magento_Catalog/js/related-products',
1111
upsellProducts: 'Magento_Catalog/js/upsell-products',
1212
productListToolbarForm: 'Magento_Catalog/js/product/list/toolbar',
13-
catalogGallery: 'Magento_Catalog/js/gallery',
14-
catalogAddToCart: 'Magento_Catalog/js/catalog-add-to-cart'
13+
catalogGallery: 'Magento_Catalog/js/gallery'
1514
}
1615
},
1716
config: {

app/code/Magento/Downloadable/Model/Product/TypeHandler/Link.php

+18-22
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2015 Adobe
4+
* All Rights Reserved.
55
*/
66
namespace Magento\Downloadable\Model\Product\TypeHandler;
77

@@ -10,7 +10,6 @@
1010
use Magento\Downloadable\Model\ComponentInterface;
1111

1212
/**
13-
* Class Link
1413
* @api
1514
* @since 100.0.2
1615
*/
@@ -22,7 +21,7 @@ class Link extends AbstractTypeHandler
2221
private $sampleItem = [];
2322

2423
/**
25-
* @var \Magento\Downloadable\Model\ComponentInterfaceFactory
24+
* @var \Magento\Downloadable\Model\LinkFactory
2625
*/
2726
private $linkFactory;
2827

@@ -49,54 +48,55 @@ public function __construct(
4948
}
5049

5150
/**
52-
* {@inheritdoc}
51+
* @inheritdoc
5352
*/
5453
public function getDataKey()
5554
{
5655
return 'link';
5756
}
5857

5958
/**
60-
* {@inheritdoc}
59+
* @inheritdoc
6160
*/
6261
public function getIdentifierKey()
6362
{
6463
return 'link_id';
6564
}
6665

6766
/**
68-
* {@inheritdoc}
67+
* @inheritdoc
6968
*/
7069
public function save(Product $product, array $data)
7170
{
7271
parent::save($product, $data);
72+
7373
if ($product->getLinksPurchasedSeparately()) {
7474
$product->setIsCustomOptionChanged();
7575
}
76+
77+
return $this;
7678
}
7779

7880
/**
79-
* {@inheritdoc}
81+
* @inheritdoc
8082
*/
8183
protected function clear()
8284
{
8385
$this->sampleItem = [];
84-
return parent::clear();
86+
87+
parent::clear();
8588
}
8689

8790
/**
88-
* @return ComponentInterface
91+
* @inheritdoc
8992
*/
9093
protected function createItem()
9194
{
9295
return $this->linkFactory->create();
9396
}
9497

9598
/**
96-
* @param ComponentInterface $model
97-
* @param array $data
98-
* @param Product $product
99-
* @return void
99+
* @inheritdoc
100100
*/
101101
protected function setDataToModel(ComponentInterface $model, array $data, Product $product)
102102
{
@@ -124,17 +124,15 @@ protected function setDataToModel(ComponentInterface $model, array $data, Produc
124124
}
125125

126126
/**
127-
* @param ComponentInterface $model
128-
* @param Product $product
129-
* @return void
127+
* @inheritdoc
130128
*/
131129
protected function linkToProduct(ComponentInterface $model, Product $product)
132130
{
133131
$product->setLastAddedLinkId($model->getId());
134132
}
135133

136134
/**
137-
* @return void
135+
* @inheritdoc
138136
*/
139137
protected function processDelete()
140138
{
@@ -144,7 +142,7 @@ protected function processDelete()
144142
}
145143

146144
/**
147-
* {@inheritdoc}
145+
* @inheritdoc
148146
*/
149147
protected function saveItem(Product $product, array $item)
150148
{
@@ -156,9 +154,7 @@ protected function saveItem(Product $product, array $item)
156154
}
157155

158156
/**
159-
* @param ComponentInterface $model
160-
* @param array $files
161-
* @return void
157+
* @inheritdoc
162158
*/
163159
protected function setFiles(ComponentInterface $model, array $files)
164160
{

app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute/Group.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2015 Adobe
4+
* All Rights Reserved.
55
*/
66
namespace Magento\Eav\Model\ResourceModel\Entity\Attribute;
77

@@ -156,12 +156,12 @@ public function updateDefaultGroup($attributeSetId)
156156
}
157157

158158
/**
159-
* {@inheritdoc}
159+
* @inheritdoc
160160
*/
161161
protected function saveNewObject(AbstractModel $object)
162162
{
163163
try {
164-
return parent::saveNewObject($object);
164+
parent::saveNewObject($object);
165165
} catch (DuplicateException $e) {
166166
throw new AttributeGroupAlreadyExistsException(
167167
__(
@@ -173,12 +173,12 @@ protected function saveNewObject(AbstractModel $object)
173173
}
174174

175175
/**
176-
* {@inheritdoc}
176+
* @inheritdoc
177177
*/
178178
protected function updateObject(AbstractModel $object)
179179
{
180180
try {
181-
return parent::updateObject($object);
181+
parent::updateObject($object);
182182
} catch (DuplicateException $e) {
183183
throw new AttributeGroupAlreadyExistsException(
184184
__(

app/code/Magento/Rule/Model/Condition/AbstractCondition.php

+11-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2011 Adobe
4+
* All Rights Reserved.
55
*/
6-
76
namespace Magento\Rule\Model\Condition;
87

98
use Magento\Framework\Data\Form;
@@ -866,6 +865,11 @@ public function validateAttribute($validatedValue)
866865
}
867866
}
868867
break;
868+
case '===':
869+
if (!is_array($validatedValue) && !is_array($value)) {
870+
$result = $this->_compareValues($validatedValue, $value);
871+
}
872+
break;
869873
}
870874

871875
if ('!=' == $option || '>' == $option || '<' == $option || '!{}' == $option || '!()' == $option) {
@@ -886,6 +890,10 @@ public function validateAttribute($validatedValue)
886890
protected function _compareValues($validatedValue, $value, $strict = true)
887891
{
888892
if ($strict && is_numeric($validatedValue) && is_numeric($value)) {
893+
$pattern = '/^0\d+$/';
894+
if (preg_match($pattern, $validatedValue) || preg_match($pattern, $value)) {
895+
return $validatedValue === $value;
896+
}
889897
return $validatedValue == $value;
890898
}
891899

app/code/Magento/Rule/Test/Unit/Model/Condition/AbstractConditionTest.php

+14-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2013 Adobe
4+
* All Rights Reserved.
55
*/
66
declare(strict_types=1);
77

@@ -65,6 +65,18 @@ public static function validateAttributeDataProvider()
6565
[null, '==', 0, false],
6666
[null, '==', 0.00, false],
6767

68+
// Test cases for strict equality with leading zeros
69+
['0123', '===', '123', false],
70+
['000123', '===', '123', false],
71+
['123', '===', '0123', false],
72+
['123', '===', '000123', false],
73+
['0123', '===', '0123', true],
74+
75+
// Test cases for strict equality with different numeric types
76+
[0123, '===', '0123', false],
77+
['123', '===', 0123, false],
78+
[0123, '===', 0123, true],
79+
6880
[1, '!=', 1, false],
6981
[0, '!=', 1, true],
7082
['0', '!=', 1, true],

app/code/Magento/Store/Block/Store/Switcher.php

+15-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2014 Adobe
4+
* All Rights Reserved.
55
*/
66

77
/**
@@ -29,15 +29,11 @@ class Switcher extends \Magento\Framework\View\Element\Template
2929
protected $_loaded = false;
3030

3131
/**
32-
* Store factory
33-
*
3432
* @var \Magento\Store\Model\StoreFactory
3533
*/
3634
protected $_storeFactory;
3735

3836
/**
39-
* Store group factory
40-
*
4137
* @var \Magento\Store\Model\GroupFactory
4238
*/
4339
protected $_storeGroupFactory;
@@ -60,17 +56,20 @@ public function __construct(
6056
}
6157

6258
/**
63-
* @return void
59+
* @inheritdoc
6460
*/
6561
protected function _construct()
6662
{
6763
$this->_loadData();
6864
$this->setStores([]);
6965
$this->setLanguages([]);
70-
return parent::_construct();
66+
67+
parent::_construct();
7168
}
7269

7370
/**
71+
* Load data
72+
*
7473
* @return $this
7574
*/
7675
protected function _loadData()
@@ -104,6 +103,8 @@ protected function _loadData()
104103
}
105104

106105
/**
106+
* Sets stores and returns their count
107+
*
107108
* @return int
108109
*/
109110
public function getStoreCount()
@@ -134,6 +135,8 @@ public function getStoreCount()
134135
}
135136

136137
/**
138+
* Sets languages and returns their count
139+
*
137140
* @return int
138141
*/
139142
public function getLanguageCount()
@@ -148,6 +151,8 @@ public function getLanguageCount()
148151
}
149152

150153
/**
154+
* Returns current store id
155+
*
151156
* @return int
152157
*/
153158
public function getCurrentStoreId()
@@ -156,6 +161,8 @@ public function getCurrentStoreId()
156161
}
157162

158163
/**
164+
* Returns current store code
165+
*
159166
* @return string
160167
*/
161168
public function getCurrentStoreCode()

0 commit comments

Comments
 (0)