Skip to content

Commit 06a8d2a

Browse files
committed
Merge remote-tracking branch 'upstream/2.4-develop' into laminas-mail
2 parents 427e4b1 + 8cdefb0 commit 06a8d2a

File tree

114 files changed

+1695
-875
lines changed

Some content is hidden

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

114 files changed

+1695
-875
lines changed

app/code/Magento/AdvancedSearch/Model/ResourceModel/Index.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,10 @@ public function __construct(
8080

8181
/**
8282
* Implementation of abstract construct
83+
*
8384
* @return void
8485
* @since 100.1.0
86+
* phpcs:disable Magento2.CodeAnalysis.EmptyBlock
8587
*/
8688
protected function _construct()
8789
{
@@ -118,7 +120,8 @@ protected function _getCatalogProductPriceData($productIds = null)
118120

119121
$result = [];
120122
foreach ($connection->fetchAll($catalogProductIndexPriceUnionSelect) as $row) {
121-
$result[$row['website_id']][$row['entity_id']][$row['customer_group_id']] = round($row['min_price'], 2);
123+
$result[$row['website_id']][$row['entity_id']][$row['customer_group_id']] =
124+
round((float) $row['min_price'], 2);
122125
}
123126

124127
return $result;

app/code/Magento/AdvancedSearch/Test/Unit/Model/ResourceModel/IndexTest.php

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ class IndexTest extends TestCase
6060
*/
6161
private $resourceConnectionMock;
6262

63+
/**
64+
* @inheritdoc
65+
*/
6366
protected function setUp(): void
6467
{
6568
$this->storeManagerMock = $this->getMockForAbstractClass(StoreManagerInterface::class);
@@ -98,6 +101,9 @@ protected function setUp(): void
98101
);
99102
}
100103

104+
/**
105+
* @return void
106+
*/
101107
public function testGetPriceIndexDataUsesFrontendPriceIndexerTable(): void
102108
{
103109
$storeId = 1;
@@ -117,4 +123,73 @@ public function testGetPriceIndexDataUsesFrontendPriceIndexerTable(): void
117123

118124
$this->assertEmpty($this->model->getPriceIndexData([1], $storeId));
119125
}
126+
127+
/**
128+
* @param array $testData
129+
* @dataProvider providerForTestPriceIndexData
130+
*
131+
* @return void
132+
*/
133+
public function testGetPriceIndexData(array $testData): void
134+
{
135+
$storeMock = $this->getMockForAbstractClass(StoreInterface::class);
136+
$storeMock->expects($this->any())->method('getId')->willReturn(1);
137+
$storeMock->method('getWebsiteId')->willReturn($testData['website_id']);
138+
$this->storeManagerMock->expects($this->once())
139+
->method('getStore')
140+
->with(1)->willReturn($storeMock);
141+
142+
$selectMock = $this->createMock(Select::class);
143+
$selectMock->expects($this->any())->method('union')->willReturnSelf();
144+
$this->adapterMock->expects($this->any())->method('select')->willReturn($selectMock);
145+
$this->adapterMock->expects($this->any())->method('fetchAll')->with($selectMock)->willReturn([$testData]);
146+
$expectedData = [
147+
$testData['entity_id'] => [
148+
$testData['customer_group_id'] => round((float) $testData['min_price'], 2)
149+
]
150+
];
151+
152+
$this->assertEquals($this->model->getPriceIndexData([1], 1), $expectedData);
153+
}
154+
155+
/**
156+
* @return array
157+
*/
158+
public function providerForTestPriceIndexData(): array
159+
{
160+
return [
161+
[
162+
[
163+
'website_id' => 1,
164+
'entity_id' => 1,
165+
'customer_group_id' => 1,
166+
'min_price' => '12.12'
167+
]
168+
],
169+
[
170+
[
171+
'website_id' => 1,
172+
'entity_id' => 2,
173+
'customer_group_id' => 2,
174+
'min_price' => null
175+
]
176+
],
177+
[
178+
[
179+
'website_id' => 1,
180+
'entity_id' => 3,
181+
'customer_group_id' => 3,
182+
'min_price' => 12.12
183+
]
184+
],
185+
[
186+
[
187+
'website_id' => 1,
188+
'entity_id' => 3,
189+
'customer_group_id' => 3,
190+
'min_price' => ''
191+
]
192+
]
193+
];
194+
}
120195
}

app/code/Magento/Backend/view/adminhtml/templates/widget/form/container.phtml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,10 @@
3232
3333
require([
3434
'jquery',
35-
'mage/backend/form',
36-
'mage/backend/validation'
35+
'mage/mage'
3736
], function($){
3837
39-
$('#edit_form').form()
40-
.validation({
38+
$('#edit_form').mage('form').mage('validation', {
4139
validationUrl: '{$block->escapeJs($block->getValidationUrl())}',
4240
highlight: function(element) {
4341
var detailsElement = $(element).closest('details');
@@ -49,8 +47,7 @@ require([
4947
}
5048
$(element).trigger('highlight.validate');
5149
}
52-
});
53-
50+
});
5451
});
5552
5653
script;

app/code/Magento/Backup/Test/Mftf/Test/AdminCreateAndDeleteBackupsTest.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
<severity value="CRITICAL"/>
1818
<testCaseId value="MAGETWO-94176"/>
1919
<group value="backup"/>
20+
<skip>
21+
<issueId value="DEPRECATED">Magento backup functionality is deprecated</issueId>
22+
</skip>
2023
</annotations>
2124
<before>
2225
<magentoCLI command="config:set {{EnableBackupFunctionality.path}} {{EnableBackupFunctionality.value}}" stepKey="setEnableBackup"/>

app/code/Magento/Bundle/Block/Adminhtml/Sales/Order/View/Items/Renderer.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
class Renderer extends \Magento\Sales\Block\Adminhtml\Order\View\Items\Renderer\DefaultRenderer
2020
{
2121
/**
22-
* Serializer
23-
*
2422
* @var Json
2523
*/
2624
private $serializer;
@@ -211,7 +209,7 @@ public function getValueHtml($item)
211209
if (!$this->isChildCalculated($item)) {
212210
$attributes = $this->getSelectionAttributes($item);
213211
if ($attributes) {
214-
$result .= " " . $this->getItem()->getOrder()->formatPrice($attributes['price']);
212+
$result .= " " . $this->getItem()->getOrder()->formatBasePrice($attributes['price']);
215213
}
216214
}
217215
return $result;

app/code/Magento/Bundle/Block/Sales/Order/Items/Renderer.php

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
class Renderer extends \Magento\Sales\Block\Order\Item\Renderer\DefaultRenderer
1717
{
1818
/**
19-
* Serializer
20-
*
2119
* @var Json
2220
*/
2321
private $serializer;
@@ -43,7 +41,10 @@ public function __construct(
4341
}
4442

4543
/**
44+
* Check if shipment type (invoice etc) is separate
45+
*
4646
* @param mixed $item
47+
*
4748
* @return bool
4849
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
4950
*/
@@ -79,7 +80,10 @@ public function isShipmentSeparately($item = null)
7980
}
8081

8182
/**
83+
* Check if sub product calculations are present
84+
*
8285
* @param mixed $item
86+
*
8387
* @return bool
8488
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
8589
*/
@@ -117,7 +121,10 @@ public function isChildCalculated($item = null)
117121
}
118122

119123
/**
124+
* Get bundle selection attributes
125+
*
120126
* @param mixed $item
127+
*
121128
* @return mixed|null
122129
*/
123130
public function getSelectionAttributes($item)
@@ -134,14 +141,17 @@ public function getSelectionAttributes($item)
134141
}
135142

136143
/**
144+
* Get html of bundle selection attributes
145+
*
137146
* @param mixed $item
147+
*
138148
* @return string
139149
*/
140150
public function getValueHtml($item)
141151
{
142152
if ($attributes = $this->getSelectionAttributes($item)) {
143153
return sprintf('%d', $attributes['qty']) . ' x ' . $this->escapeHtml($item->getName()) . " "
144-
. $this->getOrder()->formatPrice($attributes['price']);
154+
. $this->getOrder()->formatBasePrice($attributes['price']);
145155
}
146156
return $this->escapeHtml($item->getName());
147157
}
@@ -183,7 +193,10 @@ public function getChildren($item)
183193
}
184194

185195
/**
196+
* Check if price info can be shown
197+
*
186198
* @param mixed $item
199+
*
187200
* @return bool
188201
*/
189202
public function canShowPriceInfo($item)

app/code/Magento/Bundle/Model/Product/SelectionProductsDisabledRequired.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ public function __construct(
8282
* @param int $bundleId
8383
* @param int|null $websiteId
8484
* @return array
85+
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
8586
*/
8687
public function getChildProductIds(int $bundleId, ?int $websiteId = null): array
8788
{
@@ -128,10 +129,12 @@ public function getChildProductIds(int $bundleId, ?int $websiteId = null): array
128129
private function getProducts(array $selectionProductIds, int $websiteId): array
129130
{
130131
$productIds = [];
131-
$defaultStoreId = $this->storeManager->getWebsite($websiteId)->getDefaultStore()->getId();
132+
$defaultStore = $this->storeManager->getWebsite($websiteId)->getDefaultStore();
133+
$defaultStoreId = $defaultStore ? $defaultStore->getId() : null;
132134
foreach ($selectionProductIds as $optionProductIds) {
133-
$productIds = array_merge($productIds, $optionProductIds);
135+
$productIds[] = $optionProductIds;
134136
}
137+
$productIds = array_merge([], ...$productIds);
135138
$productCollection = $this->productCollectionFactory->create();
136139
$productCollection->joinAttribute(
137140
ProductInterface::STATUS,

app/code/Magento/Catalog/Controller/Adminhtml/Category/Save.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
use Magento\Store\Model\StoreManagerInterface;
1313

1414
/**
15-
* Class Save
15+
* Category save controller
1616
*
1717
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1818
*/
@@ -144,10 +144,10 @@ public function execute()
144144
$categoryPostData = $this->stringToBoolConverting($categoryPostData);
145145
$categoryPostData = $this->imagePreprocessing($categoryPostData);
146146
$categoryPostData = $this->dateTimePreprocessing($category, $categoryPostData);
147-
$storeId = isset($categoryPostData['store_id']) ? $categoryPostData['store_id'] : null;
147+
$storeId = $categoryPostData['store_id'] ?? null;
148148
$store = $this->storeManager->getStore($storeId);
149149
$this->storeManager->setCurrentStore($store->getCode());
150-
$parentId = isset($categoryPostData['parent']) ? $categoryPostData['parent'] : null;
150+
$parentId = $categoryPostData['parent'] ?? null;
151151
if ($categoryPostData) {
152152
$category->addData($categoryPostData);
153153
if ($parentId) {
@@ -168,7 +168,7 @@ public function execute()
168168
if (isset($categoryPostData['use_config']) && !empty($categoryPostData['use_config'])) {
169169
foreach ($categoryPostData['use_config'] as $attributeCode => $attributeValue) {
170170
if ($attributeValue) {
171-
$useConfig[] = $attributeCode;
171+
$useConfig[] = $attributeValue;
172172
$category->setData($attributeCode, null);
173173
}
174174
}
@@ -220,7 +220,11 @@ public function execute()
220220
__('The "%1" attribute is required. Enter and try again.', $attribute)
221221
);
222222
} else {
223-
$this->messageManager->addErrorMessage(__('Something went wrong while saving the category.'));
223+
$this->messageManager->addErrorMessage(
224+
__(
225+
'Something went wrong while saving the category.'
226+
)
227+
);
224228
$this->logger->critical('Something went wrong while saving the category.');
225229
$this->_getSession()->setCategoryData($categoryPostData);
226230
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminNavigateToProductAttributeEditPageActionGroup">
12+
<annotations>
13+
<description>Navigate to the given product attribute edit page by attribute label</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="ProductAttributeLabel" type="string"/>
17+
</arguments>
18+
19+
<amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="navigateToProductAttributeGrid"/>
20+
<fillField selector="{{AdminProductAttributeGridSection.GridFilterFrontEndLabel}}" userInput="{{ProductAttributeLabel}}" stepKey="fillTheAttributesFilterByLabel"/>
21+
<click selector="{{AdminProductAttributeGridSection.Search}}" stepKey="clickTheSearchButton"/>
22+
<waitForPageLoad stepKey="waitForSearchToComplete"/>
23+
<click selector="{{AdminProductAttributeGridSection.FirstRow}}" stepKey="clickOnTheFirstSearchResultRow"/>
24+
<waitForPageLoad stepKey="waitForAttribiteEditPageToLoad"/>
25+
</actionGroup>
26+
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/Section/StorefrontCategoryFilterSection.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1111
<section name="StorefrontCategoryFilterSection">
12-
<element name="CategoryFilter" type="button" selector="//main//div[@class='filter-options']//div[contains(text(), 'Category')]"/>
12+
<element name="CategoryFilter" type="button" selector="//main//div[contains(@class,'filter-options')]//div[contains(text(), 'Category')]"/>
1313
<element name="CategoryByName" type="button" selector="//main//div[@class='filter-options']//li[@class='item']//a[contains(text(), '{{var1}}')]" parameterized="true"/>
1414
</section>
1515
</sections>

0 commit comments

Comments
 (0)