Skip to content

Commit b75440e

Browse files
authored
Merge branch '2.4-develop' into bug/elasticsearch-issue-with-synonyms
2 parents c36f29b + 9a5573b commit b75440e

File tree

117 files changed

+1980
-449
lines changed

Some content is hidden

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

117 files changed

+1980
-449
lines changed

app/code/Magento/Backend/Model/Widget/Grid/AbstractTotals.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ protected function _countExpr($expr, $collection)
117117
foreach ($parsedExpression as $operand) {
118118
if ($this->_parser->isOperation($operand)) {
119119
$this->_checkOperandsSet($firstOperand, $secondOperand, $tmpResult, $result);
120-
$result = $this->_operate($firstOperand, $secondOperand, $operand, $tmpResult, $result);
120+
$result = $this->_operate($firstOperand, $secondOperand, $operand);
121121
$firstOperand = $secondOperand = null;
122122
} else {
123123
if (null === $firstOperand) {
@@ -133,9 +133,9 @@ protected function _countExpr($expr, $collection)
133133
/**
134134
* Check if operands in not null and set operands values if they are empty
135135
*
136-
* @param float|int &$firstOperand
137-
* @param float|int &$secondOperand
138-
* @param float|int &$tmpResult
136+
* @param float|int $firstOperand
137+
* @param float|int $secondOperand
138+
* @param float|int $tmpResult
139139
* @param float|int $result
140140
* @return void
141141
*/

app/code/Magento/Backend/Test/Unit/Helper/DataTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ protected function setUp(): void
4242
$this->createMock(Auth::class),
4343
$this->_frontResolverMock,
4444
$this->createMock(Random::class),
45-
$this->getMockForAbstractClass(RequestInterface::class)
4645
);
4746
}
4847

app/code/Magento/Catalog/Block/Product/View/Details.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,11 @@ class Details extends \Magento\Framework\View\Element\Template
2727
*
2828
* @return array
2929
* @since 103.0.1
30+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
3031
*/
3132
public function getGroupSortedChildNames(string $groupName, string $callback): array
3233
{
33-
$groupChildNames = $this->getGroupChildNames($groupName, $callback);
34+
$groupChildNames = $this->getGroupChildNames($groupName);
3435
$layout = $this->getLayout();
3536

3637
$childNamesSortOrder = [];

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ class Tree extends Dbp
2424

2525
const LEVEL_FIELD = 'level';
2626

27+
/**
28+
* @var array
29+
*/
30+
private $_inactiveItems;
31+
2732
/**
2833
* @var \Magento\Framework\Event\ManagerInterface
2934
*/
@@ -290,7 +295,7 @@ protected function _getDisabledIds($collection, $allIds)
290295
foreach ($allIds as $id) {
291296
$parents = $this->getNodeById($id)->getPath();
292297
foreach ($parents as $parent) {
293-
if (!$this->_getItemIsActive($parent->getId(), $storeId)) {
298+
if (!$this->_getItemIsActive($parent->getId())) {
294299
$disabledIds[] = $id;
295300
continue;
296301
}
@@ -680,6 +685,8 @@ public function getExistingCategoryIdsBySpecifiedIds($ids)
680685
}
681686

682687
/**
688+
* Get entity methadata pool.
689+
*
683690
* @return \Magento\Framework\EntityManager\MetadataPool
684691
*/
685692
private function getMetadataPool()

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ protected function _saveAttributeValue($object, $attribute, $value)
160160
$storeId = (int) $this->_storeManager->getStore($object->getStoreId())->getId();
161161
$table = $attribute->getBackend()->getTable();
162162

163-
$entityId = $this->resolveEntityId($object->getId(), $table);
163+
$entityId = $this->resolveEntityId($object->getId());
164164

165165
/**
166166
* If we work in single store mode all values should be saved just

app/code/Magento/Catalog/Test/Mftf/Test/CheckTierPricingOfProductsTest.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,7 @@
127127
<waitForPageLoad stepKey="waitForCustomersPage"/>
128128
<see userInput="You saved the customer." stepKey="CustomerIsSaved"/>
129129

130-
<amOnPage url="{{AdminCustomerPage.url}}" stepKey="navigateToCustomers"/>
131-
<waitForPageLoad stepKey="waitForPageLoad1" />
130+
<actionGroup ref="AdminOpenCustomersGridActionGroup" stepKey="navigateToCustomers"/>
132131
<click selector="{{AdminCustomerFiltersSection.clearAll}}" stepKey="ClearFilters"/>
133132
<waitForPageLoad stepKey="waitForFiltersClear"/>
134133

app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/RepositoryTest.php

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,6 @@ class RepositoryTest extends TestCase
8383
*/
8484
protected $searchResultMock;
8585

86-
/**
87-
* @var AttributeOptionManagementInterface|MockObject
88-
*/
89-
private $optionManagementMock;
90-
9186
/**
9287
* @inheritdoc
9388
*/
@@ -116,8 +111,6 @@ protected function setUp(): void
116111
['getItems', 'getSearchCriteria', 'getTotalCount', 'setItems', 'setSearchCriteria', 'setTotalCount']
117112
)
118113
->getMockForAbstractClass();
119-
$this->optionManagementMock =
120-
$this->getMockForAbstractClass(ProductAttributeOptionManagementInterface::class);
121114

122115
$this->model = new Repository(
123116
$this->attributeResourceMock,
@@ -126,8 +119,7 @@ protected function setUp(): void
126119
$this->eavAttributeRepositoryMock,
127120
$this->eavConfigMock,
128121
$this->validatorFactoryMock,
129-
$this->searchCriteriaBuilderMock,
130-
$this->optionManagementMock
122+
$this->searchCriteriaBuilderMock
131123
);
132124
}
133125

@@ -291,7 +283,6 @@ public function testSaveDoesNotSaveAttributeOptionsIfOptionsAreAbsentInPayload()
291283
// Attribute code must not be changed after attribute creation
292284
$attributeMock->expects($this->once())->method('setAttributeCode')->with($attributeCode);
293285
$this->attributeResourceMock->expects($this->once())->method('save')->with($attributeMock);
294-
$this->optionManagementMock->expects($this->never())->method('add');
295286

296287
$this->model->save($attributeMock);
297288
}

app/code/Magento/Catalog/Test/Unit/Model/Product/Option/Validator/SelectTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ protected function setUp(): void
6666
];
6767
$configMock->expects($this->once())->method('getAll')->willReturn($config);
6868
$methods = ['getTitle', 'getType', 'getPriceType', 'getPrice', 'getData'];
69-
$this->valueMock = $this->createPartialMock(Option::class, $methods, []);
69+
$this->valueMock = $this->createPartialMock(Option::class, $methods);
7070
$this->validator = new Select(
7171
$configMock,
7272
$priceConfigMock,

app/code/Magento/Catalog/Test/Unit/Model/Product/Price/PricePersistenceTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ public function testDeleteWithException()
301301
->willReturn($idsBySku);
302302
$this->attributeRepository->expects($this->once())->method('get')->willReturn($this->productAttribute);
303303
$this->productAttribute->expects($this->once())->method('getAttributeId')->willReturn($attributeId);
304-
$this->attributeResource->expects($this->atLeastOnce(2))->method('getConnection')
304+
$this->attributeResource->expects($this->atLeastOnce())->method('getConnection')
305305
->willReturn($this->connection);
306306
$this->connection->expects($this->once())->method('beginTransaction')->willReturnSelf();
307307
$this->attributeResource

app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ public function validate(Observer $observer)
193193
$option->setHasError(true);
194194
//Setting this to false, so no error statuses are cleared
195195
$removeError = false;
196-
$this->addErrorInfoToQuote($result, $quoteItem, $removeError);
196+
$this->addErrorInfoToQuote($result, $quoteItem);
197197
}
198198
}
199199
if ($removeError) {

app/code/Magento/CatalogInventory/Test/Unit/Model/Plugin/AfterProductLoadTest.php

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,6 @@ class AfterProductLoadTest extends TestCase
3030
*/
3131
protected $productMock;
3232

33-
/**
34-
* @var ProductExtensionFactory|MockObject
35-
*/
36-
protected $productExtensionFactoryMock;
37-
3833
/**
3934
* @var ProductExtensionInterface|MockObject
4035
*/
@@ -43,16 +38,9 @@ class AfterProductLoadTest extends TestCase
4338
protected function setUp(): void
4439
{
4540
$stockRegistryMock = $this->getMockForAbstractClass(StockRegistryInterface::class);
46-
$this->productExtensionFactoryMock = $this->getMockBuilder(
47-
ProductExtensionFactory::class
48-
)
49-
->setMethods(['create'])
50-
->disableOriginalConstructor()
51-
->getMock();
5241

5342
$this->plugin = new AfterProductLoad(
54-
$stockRegistryMock,
55-
$this->productExtensionFactoryMock
43+
$stockRegistryMock
5644
);
5745

5846
$productId = 5494;
@@ -88,8 +76,6 @@ public function testAfterLoad()
8876
$this->productMock->expects($this->once())
8977
->method('getExtensionAttributes')
9078
->willReturn($this->productExtensionMock);
91-
$this->productExtensionFactoryMock->expects($this->never())
92-
->method('create');
9379

9480
$this->assertEquals(
9581
$this->productMock,

app/code/Magento/ConfigurableProduct/Helper/Data.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@
77
namespace Magento\ConfigurableProduct\Helper;
88

99
use Magento\Catalog\Model\Product\Image\UrlBuilder;
10+
use Magento\ConfigurableProduct\Model\Product\Type\Configurable;
1011
use Magento\Framework\App\ObjectManager;
1112
use Magento\Catalog\Helper\Image as ImageHelper;
1213
use Magento\Catalog\Api\Data\ProductInterface;
14+
use Magento\Catalog\Model\Product;
1315
use Magento\Catalog\Model\Product\Image;
1416

1517
/**
@@ -73,7 +75,7 @@ public function getGalleryImages(ProductInterface $product)
7375
/**
7476
* Get Options for Configurable Product Options
7577
*
76-
* @param \Magento\Catalog\Model\Product $currentProduct
78+
* @param Product $currentProduct
7779
* @param array $allowedProducts
7880
* @return array
7981
*/
@@ -100,11 +102,13 @@ public function getOptions($currentProduct, $allowedProducts)
100102
/**
101103
* Get allowed attributes
102104
*
103-
* @param \Magento\Catalog\Model\Product $product
105+
* @param Product $product
104106
* @return array
105107
*/
106108
public function getAllowAttributes($product)
107109
{
108-
return $product->getTypeInstance()->getConfigurableAttributes($product);
110+
return ($product->getTypeId() == Configurable::TYPE_CODE)
111+
? $product->getTypeInstance()->getConfigurableAttributes($product)
112+
: [];
109113
}
110114
}

app/code/Magento/ConfigurableProduct/Test/Unit/Helper/DataTest.php

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ protected function setUp(): void
4949
->getMock();
5050
$this->_imageHelperMock = $this->createMock(Image::class);
5151
$this->_productMock = $this->createMock(Product::class);
52-
52+
$this->_productMock->setTypeId(Configurable::TYPE_CODE);
5353
$this->_model = $objectManager->getObject(
5454
Data::class,
5555
[
@@ -66,6 +66,10 @@ public function testGetAllowAttributes()
6666
->method('getConfigurableAttributes')
6767
->with($this->_productMock);
6868

69+
$this->_productMock->expects($this->once())
70+
->method('getTypeId')
71+
->willReturn(Configurable::TYPE_CODE);
72+
6973
$this->_productMock->expects($this->once())
7074
->method('getTypeInstance')
7175
->willReturn($typeInstanceMock);
@@ -114,12 +118,16 @@ public function testGetOptions(array $expected, array $data)
114118

115119
/**
116120
* @return array
121+
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
117122
*/
118-
public function getOptionsDataProvider()
123+
public function getOptionsDataProvider(): array
119124
{
120125
$currentProductMock = $this->createPartialMock(
121126
Product::class,
122-
['getTypeInstance']
127+
[
128+
'getTypeInstance',
129+
'getTypeId'
130+
]
123131
);
124132
$provider = [];
125133
$provider[] = [
@@ -156,6 +164,9 @@ public function getOptionsDataProvider()
156164
$typeInstanceMock->expects($this->any())
157165
->method('getConfigurableAttributes')
158166
->willReturn($attributes);
167+
$currentProductMock->expects($this->any())
168+
->method('getTypeId')
169+
->willReturn(Configurable::TYPE_CODE);
159170
$currentProductMock->expects($this->any())
160171
->method('getTypeInstance')
161172
->willReturn($typeInstanceMock);
@@ -215,7 +226,7 @@ public function getOptionsDataProvider()
215226
* @param string $key
216227
* @return string
217228
*/
218-
public function getDataCallback($key)
229+
public function getDataCallback($key): string
219230
{
220231
$map = [];
221232
for ($k = 1; $k < 3; $k++) {
@@ -279,7 +290,7 @@ public function testGetGalleryImages()
279290
/**
280291
* @return Collection
281292
*/
282-
private function getImagesCollection()
293+
private function getImagesCollection(): MockObject
283294
{
284295
$collectionMock = $this->getMockBuilder(Collection::class)
285296
->disableOriginalConstructor()

0 commit comments

Comments
 (0)