Skip to content

Commit 73d032f

Browse files
committed
Merge branch '2.4-develop' of github.com:magento/magento2 into 1711-use-product-model-instead-of-data-object-for-catalog-image-helper-init
2 parents c72447f + b817af4 commit 73d032f

File tree

244 files changed

+3781
-1077
lines changed

Some content is hidden

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

244 files changed

+3781
-1077
lines changed

app/code/Magento/AdminAnalytics/view/adminhtml/templates/tracking.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<?= /* @noEscape */ $secureRenderer->renderTag(
1313
'script',
1414
[
15-
'src' => '"' . $block->escapeJs($block->getTrackingUrl()) .'"',
15+
'src' => $block->getTrackingUrl(),
1616
'async' => true,
1717
],
1818
'&nbsp;',

app/code/Magento/Backend/Block/Widget/Grid/Export.php

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
use Magento\Framework\App\Filesystem\DirectoryList;
1010

1111
/**
12+
* Class Export for exporting grid data as CSV file or MS Excel 2003 XML Document file
13+
*
1214
* @api
1315
* @deprecated 100.2.0 in favour of UI component implementation
1416
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -69,6 +71,8 @@ public function __construct(
6971
}
7072

7173
/**
74+
* Internal constructor, that is called from real constructor
75+
*
7276
* @return void
7377
* @throws \Magento\Framework\Exception\LocalizedException
7478
*/
@@ -242,6 +246,7 @@ protected function _getExportTotals()
242246

243247
/**
244248
* Iterate collection and call callback method per item
249+
*
245250
* For callback method first argument always is item object
246251
*
247252
* @param string $callback
@@ -273,7 +278,12 @@ public function _exportIterateCollection($callback, array $args)
273278

274279
$collection = $this->_getRowCollection($originalCollection);
275280
foreach ($collection as $item) {
276-
call_user_func_array([$this, $callback], array_merge([$item], $args));
281+
//phpcs:ignore Magento2.Functions.DiscouragedFunction
282+
call_user_func_array(
283+
[$this, $callback],
284+
// phpcs:ignore Magento2.Performance.ForeachArrayMerge
285+
array_merge([$item], $args)
286+
);
277287
}
278288
}
279289
}
@@ -307,7 +317,7 @@ protected function _exportCsvItem(
307317
*/
308318
public function getCsvFile()
309319
{
310-
$name = md5(microtime());
320+
$name = hash('sha256', microtime());
311321
$file = $this->_path . '/' . $name . '.csv';
312322

313323
$this->_directory->create($this->_path);
@@ -432,11 +442,11 @@ public function getRowRecord(\Magento\Framework\DataObject $data)
432442
*/
433443
public function getExcelFile($sheetName = '')
434444
{
435-
$collection = $this->_getRowCollection();
445+
$collection = $this->_getPreparedCollection();
436446

437447
$convert = new \Magento\Framework\Convert\Excel($collection->getIterator(), [$this, 'getRowRecord']);
438448

439-
$name = md5(microtime());
449+
$name = hash('sha256', microtime());
440450
$file = $this->_path . '/' . $name . '.xml';
441451

442452
$this->_directory->create($this->_path);
@@ -551,6 +561,8 @@ public function _getPreparedCollection()
551561
}
552562

553563
/**
564+
* Get export page size
565+
*
554566
* @return int
555567
*/
556568
public function getExportPageSize()

app/code/Magento/Backend/Block/Widget/Grid/Extended.php

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
use Magento\Framework\App\Filesystem\DirectoryList;
99

1010
/**
11+
* Extended Grid Widget
12+
*
1113
* @api
1214
* @deprecated 100.2.0 in favour of UI component implementation
1315
* @SuppressWarnings(PHPMD.ExcessivePublicCount)
@@ -177,7 +179,10 @@ class Extended extends \Magento\Backend\Block\Widget\Grid implements \Magento\Ba
177179
protected $_path = 'export';
178180

179181
/**
182+
* Initialization
183+
*
180184
* @return void
185+
* @throws \Magento\Framework\Exception\FileSystemException
181186
*/
182187
protected function _construct()
183188
{
@@ -297,6 +302,7 @@ public function addColumn($columnId, $column)
297302
);
298303
$this->getColumnSet()->getChildBlock($columnId)->setGrid($this);
299304
} else {
305+
// phpcs:ignore Magento2.Exceptions.DirectThrow
300306
throw new \Exception(__('Please correct the column format and try again.'));
301307
}
302308

@@ -471,10 +477,6 @@ protected function _prepareMassactionColumn()
471477
protected function _prepareCollection()
472478
{
473479
if ($this->getCollection()) {
474-
if ($this->getCollection()->isLoaded()) {
475-
$this->getCollection()->clear();
476-
}
477-
478480
parent::_prepareCollection();
479481

480482
if (!$this->_isExport) {
@@ -663,6 +665,7 @@ public function setEmptyCellLabel($label)
663665
*/
664666
public function getRowUrl($item)
665667
{
668+
// phpstan:ignore "Call to an undefined static method"
666669
$res = parent::getRowUrl($item);
667670
return $res ? $res : '#';
668671
}
@@ -680,6 +683,7 @@ public function getMultipleRows($item)
680683

681684
/**
682685
* Retrieve columns for multiple rows
686+
*
683687
* @return array
684688
*/
685689
public function getMultipleRowColumns()
@@ -943,6 +947,7 @@ protected function _getExportTotals()
943947

944948
/**
945949
* Iterate collection and call callback method per item
950+
*
946951
* For callback method first argument always is item object
947952
*
948953
* @param string $callback
@@ -972,7 +977,12 @@ public function _exportIterateCollection($callback, array $args)
972977
$page++;
973978

974979
foreach ($collection as $item) {
975-
call_user_func_array([$this, $callback], array_merge([$item], $args));
980+
//phpcs:ignore Magento2.Functions.DiscouragedFunction
981+
call_user_func_array(
982+
[$this, $callback],
983+
// phpcs:ignore Magento2.Performance.ForeachArrayMerge
984+
array_merge([$item], $args)
985+
);
976986
}
977987
}
978988
}
@@ -1009,6 +1019,7 @@ public function getCsvFile()
10091019
$this->_isExport = true;
10101020
$this->_prepareGrid();
10111021

1022+
// phpcs:ignore Magento2.Security.InsecureFunction
10121023
$name = md5(microtime());
10131024
$file = $this->_path . '/' . $name . '.csv';
10141025

@@ -1153,6 +1164,7 @@ public function getExcelFile($sheetName = '')
11531164
[$this, 'getRowRecord']
11541165
);
11551166

1167+
// phpcs:ignore Magento2.Security.InsecureFunction
11561168
$name = md5(microtime());
11571169
$file = $this->_path . '/' . $name . '.xml';
11581170

@@ -1244,7 +1256,7 @@ public function setCollection($collection)
12441256
}
12451257

12461258
/**
1247-
* get collection object
1259+
* Get collection object
12481260
*
12491261
* @return \Magento\Framework\Data\Collection
12501262
*/

app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/ExtendedTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ public function testPrepareLoadedCollection()
4141
$layout->expects($this->any())->method('getBlock')->willReturn($columnSet);
4242

4343
$collection = $this->createMock(Collection::class);
44-
$collection->expects($this->atLeastOnce())->method('isLoaded')->willReturn(true);
45-
$collection->expects($this->atLeastOnce())->method('clear');
44+
$collection->expects($this->never())->method('isLoaded');
45+
$collection->expects($this->never())->method('clear');
4646
$collection->expects($this->atLeastOnce())->method('load');
4747

4848
/** @var Extended $block */

app/code/Magento/Backend/view/adminhtml/layout/default.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@
7070
<argument name="bugreport_url" xsi:type="string">https://github.com/magento/magento2/issues</argument>
7171
</arguments>
7272
</block>
73-
7473
</container>
7574
</container>
7675
</referenceContainer>

app/code/Magento/Backend/view/adminhtml/requirejs-config.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
var config = {
77
map: {
88
'*': {
9-
'mediaUploader': 'Magento_Backend/js/media-uploader',
10-
'mage/translate': 'Magento_Backend/js/translate'
9+
'mediaUploader': 'Magento_Backend/js/media-uploader'
1110
}
1211
}
1312
};
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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="AdminAssertBackupLinkAbsentInMenuActionGroup">
12+
<annotations>
13+
<description>Verify 'Backup' link is absent in admin menu.</description>
14+
</annotations>
15+
16+
<click selector="{{AdminMenuSection.menuItem('magento-backend-system')}}" stepKey="clickSystem"/>
17+
<dontSeeElement selector="{{AdminMenuSection.menuItem('magento-backup-system-tools-backup')}}" stepKey="dontSeeBackup"/>
18+
</actionGroup>
19+
</actionGroups>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="AdminSystemBackupMenuTest">
12+
<annotations>
13+
<features value="Backup"/>
14+
<stories value="Backup menu not visible if config disabled"/>
15+
<title value="Backup menu not visible if backup config disabled"/>
16+
<description value="Disable backup config and check backup menu isn't visible"/>
17+
<severity value="AVERAGE"/>
18+
<testCaseId value="MC-36292"/>
19+
<group value="backup"/>
20+
</annotations>
21+
<before>
22+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
23+
</before>
24+
<after>
25+
<actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/>
26+
</after>
27+
28+
<actionGroup ref="AdminAssertBackupLinkAbsentInMenuActionGroup" stepKey="verifyBackupLinkAbsentInMenu"/>
29+
</test>
30+
</tests>

app/code/Magento/Backup/etc/adminhtml/menu.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd">
99
<menu>
10-
<add id="Magento_Backup::system_tools_backup" title="Backups" translate="title" module="Magento_Backup" sortOrder="30" parent="Magento_Backend::system_tools" action="backup/index" resource="Magento_Backup::backup"/>
10+
<add id="Magento_Backup::system_tools_backup" title="Backups" translate="title" module="Magento_Backup" sortOrder="30" parent="Magento_Backend::system_tools" action="backup/index" resource="Magento_Backup::backup" dependsOnConfig="system/backup/functionality_enabled"/>
1111
</menu>
1212
</config>

app/code/Magento/Bundle/Test/Mftf/Test/StorefrontVerifyDynamicBundleProductPricesForCombinationOfOptionsTest.xml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@
163163

164164
<!-- Save the settings -->
165165
<scrollToTopOfPage stepKey="scrollToTop"/>
166-
<click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveTaxOptions"/>
167-
<waitForPageLoad stepKey="waitForTaxSaved"/>
166+
<actionGroup ref="AdminSaveCategoryActionGroup" stepKey="saveTaxOptions"/>
167+
168168
<see userInput="You saved the configuration." selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="seeSuccess"/>
169169

170170
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
@@ -192,8 +192,7 @@
192192

193193
<!-- Save the settings -->
194194
<scrollToTopOfPage stepKey="scrollToTop"/>
195-
<click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveTaxOptions"/>
196-
<waitForPageLoad stepKey="waitForTaxSaved"/>
195+
<actionGroup ref="AdminSaveCategoryActionGroup" stepKey="saveTaxOptions"/>
197196
<see userInput="You saved the configuration." selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="seeSuccess"/>
198197

199198
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>

app/code/Magento/Captcha/etc/adminhtml/system.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
<depends>
5858
<field id="enable">1</field>
5959
</depends>
60-
<frontend_class>required-entry</frontend_class>
60+
<frontend_class>required-entry validate-range range-1-8</frontend_class>
6161
</field>
6262
<field id="symbols" translate="label comment" type="text" sortOrder="8" showInDefault="1" canRestore="1">
6363
<label>Symbols Used in CAPTCHA</label>

app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminSubmitAdvancedInventoryFormActionGroup.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@
1616
</annotations>
1717

1818
<click stepKey="clickOnDoneButton" selector="{{AdminProductFormAdvancedInventorySection.doneButton}}"/>
19+
<waitForPageLoad stepKey="waitForProductPageToLoad"/>
1920
</actionGroup>
2021
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminSubmitCategoriesPopupActionGroup.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@
1414
</annotations>
1515

1616
<click selector="{{AdminProductFormSection.done}}" stepKey="clickOnDoneButton" />
17+
<waitForPageLoad stepKey="waitForCategoryApply"/>
1718
</actionGroup>
1819
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/ActionGroup/SearchProductGridByKeywordActionGroup.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@
1919
<conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/>
2020
<fillField selector="{{AdminProductGridFilterSection.keywordSearch}}" userInput="{{keyword}}" stepKey="fillKeywordSearchField"/>
2121
<click selector="{{AdminProductGridFilterSection.keywordSearchButton}}" stepKey="clickKeywordSearch"/>
22+
<waitForPageLoad stepKey="waitForProductSearch"/>
2223
</actionGroup>
2324
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/Data/CategoryData.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,4 +265,8 @@
265265
<data key="level">0</data>
266266
<var key="parent_id" entityType="category" entityKey="id"/>
267267
</entity>
268+
<entity name="AssignProductToCategory" type="category_product_link">
269+
<var key="category_id" entityKey="id" entityType="category"/>
270+
<var key="sku" entityKey="sku" entityType="product"/>
271+
</entity>
268272
</entities>

app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,6 +1252,20 @@
12521252
<requiredEntity type="product_extension_attribute">EavStock777</requiredEntity>
12531253
<requiredEntity type="custom_attribute_array">CustomAttributeCategoryIds</requiredEntity>
12541254
</entity>
1255+
<entity name="SimpleProduct_zero" type="product">
1256+
<data key="sku" unique="suffix">testSku</data>
1257+
<data key="type_id">simple</data>
1258+
<data key="attribute_set_id">4</data>
1259+
<data key="visibility">4</data>
1260+
<data key="name" unique="suffix">testProductName</data>
1261+
<data key="price">0.00</data>
1262+
<data key="urlKey" unique="suffix">testurlkey</data>
1263+
<data key="status">1</data>
1264+
<data key="quantity">777</data>
1265+
<data key="weight">1</data>
1266+
<requiredEntity type="product_extension_attribute">EavStock777</requiredEntity>
1267+
<requiredEntity type="custom_attribute_array">CustomAttributeCategoryIds</requiredEntity>
1268+
</entity>
12551269
<entity name="ApiSimpleOneQty10" type="product2">
12561270
<data key="sku" unique="suffix">api-simple-product</data>
12571271
<data key="type_id">simple</data>

app/code/Magento/Catalog/Test/Mftf/Metadata/CategoryMeta.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,12 @@
5757
<operation name="DeleteCategory" dataType="category" type="delete" auth="adminOauth" url="/V1/categories/{id}" method="DELETE">
5858
<contentType>application/json</contentType>
5959
</operation>
60+
61+
<operation name="AssignProductToCategory" dataType="category_product_link" type="create" auth="adminOauth" url="/V1/categories/{id}/products" method="POST">
62+
<contentType>application/json</contentType>
63+
<object key="productLink" dataType="category_product_link">
64+
<field key="sku">string</field>
65+
<field key="category_id">string</field>
66+
</object>
67+
</operation>
6068
</operations>

app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection/ProductWYSIWYGSection.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1010
<section name="ProductWYSIWYGSection">
1111
<element name="Switcher" type="button" selector="select#dropdown-switcher"/>
12-
<element name="v436" type="button" selector="//select[@id='dropdown-switcher']/option[text()='TinyMCE 4.3.6']"/>
13-
<element name="v3" type="button" selector="//select[@id='dropdown-switcher']/option[text()='TinyMCE 3.6(Deprecated)']"/>
12+
<element name="v436" type="button" selector="//select[@id='dropdown-switcher']/option[text()='TinyMCE 4.3.6']" deprecated="New element was introduced. Please use 'ProductWYSIWYGSection.v4910'"/>
13+
<element name="v3" type="button" selector="//select[@id='dropdown-switcher']/option[text()='TinyMCE 3.6(Deprecated)']" deprecated="New element was introduced. Please use 'ProductWYSIWYGSection.v4910'"/>
14+
<element name="v4910" type ="button" selector="//select[@id='dropdown-switcher']/option[text()='TinyMCE 4.9.10']" />
1415
<element name="TinymceDescription3" type="button" selector="//span[text()='Description']"/>
1516
<element name="SaveConfig" type="button" selector="#save"/>
1617
<element name="v4" type="button" selector="#category_form_description_v4"/>

0 commit comments

Comments
 (0)