Skip to content

Commit

Permalink
Merge branch '2.4-develop' of github.com:magento/magento2 into 1711-u…
Browse files Browse the repository at this point in the history
…se-product-model-instead-of-data-object-for-catalog-image-helper-init
  • Loading branch information
jmonteros422 committed Aug 11, 2020
2 parents c72447f + b817af4 commit 73d032f
Show file tree
Hide file tree
Showing 244 changed files with 3,781 additions and 1,077 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<?= /* @noEscape */ $secureRenderer->renderTag(
'script',
[
'src' => '"' . $block->escapeJs($block->getTrackingUrl()) .'"',
'src' => $block->getTrackingUrl(),
'async' => true,
],
'&nbsp;',
Expand Down
20 changes: 16 additions & 4 deletions app/code/Magento/Backend/Block/Widget/Grid/Export.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
use Magento\Framework\App\Filesystem\DirectoryList;

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

/**
* Internal constructor, that is called from real constructor
*
* @return void
* @throws \Magento\Framework\Exception\LocalizedException
*/
Expand Down Expand Up @@ -242,6 +246,7 @@ protected function _getExportTotals()

/**
* Iterate collection and call callback method per item
*
* For callback method first argument always is item object
*
* @param string $callback
Expand Down Expand Up @@ -273,7 +278,12 @@ public function _exportIterateCollection($callback, array $args)

$collection = $this->_getRowCollection($originalCollection);
foreach ($collection as $item) {
call_user_func_array([$this, $callback], array_merge([$item], $args));
//phpcs:ignore Magento2.Functions.DiscouragedFunction
call_user_func_array(
[$this, $callback],
// phpcs:ignore Magento2.Performance.ForeachArrayMerge
array_merge([$item], $args)
);
}
}
}
Expand Down Expand Up @@ -307,7 +317,7 @@ protected function _exportCsvItem(
*/
public function getCsvFile()
{
$name = md5(microtime());
$name = hash('sha256', microtime());
$file = $this->_path . '/' . $name . '.csv';

$this->_directory->create($this->_path);
Expand Down Expand Up @@ -432,11 +442,11 @@ public function getRowRecord(\Magento\Framework\DataObject $data)
*/
public function getExcelFile($sheetName = '')
{
$collection = $this->_getRowCollection();
$collection = $this->_getPreparedCollection();

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

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

$this->_directory->create($this->_path);
Expand Down Expand Up @@ -551,6 +561,8 @@ public function _getPreparedCollection()
}

/**
* Get export page size
*
* @return int
*/
public function getExportPageSize()
Expand Down
24 changes: 18 additions & 6 deletions app/code/Magento/Backend/Block/Widget/Grid/Extended.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
use Magento\Framework\App\Filesystem\DirectoryList;

/**
* Extended Grid Widget
*
* @api
* @deprecated 100.2.0 in favour of UI component implementation
* @SuppressWarnings(PHPMD.ExcessivePublicCount)
Expand Down Expand Up @@ -177,7 +179,10 @@ class Extended extends \Magento\Backend\Block\Widget\Grid implements \Magento\Ba
protected $_path = 'export';

/**
* Initialization
*
* @return void
* @throws \Magento\Framework\Exception\FileSystemException
*/
protected function _construct()
{
Expand Down Expand Up @@ -297,6 +302,7 @@ public function addColumn($columnId, $column)
);
$this->getColumnSet()->getChildBlock($columnId)->setGrid($this);
} else {
// phpcs:ignore Magento2.Exceptions.DirectThrow
throw new \Exception(__('Please correct the column format and try again.'));
}

Expand Down Expand Up @@ -471,10 +477,6 @@ protected function _prepareMassactionColumn()
protected function _prepareCollection()
{
if ($this->getCollection()) {
if ($this->getCollection()->isLoaded()) {
$this->getCollection()->clear();
}

parent::_prepareCollection();

if (!$this->_isExport) {
Expand Down Expand Up @@ -663,6 +665,7 @@ public function setEmptyCellLabel($label)
*/
public function getRowUrl($item)
{
// phpstan:ignore "Call to an undefined static method"
$res = parent::getRowUrl($item);
return $res ? $res : '#';
}
Expand All @@ -680,6 +683,7 @@ public function getMultipleRows($item)

/**
* Retrieve columns for multiple rows
*
* @return array
*/
public function getMultipleRowColumns()
Expand Down Expand Up @@ -943,6 +947,7 @@ protected function _getExportTotals()

/**
* Iterate collection and call callback method per item
*
* For callback method first argument always is item object
*
* @param string $callback
Expand Down Expand Up @@ -972,7 +977,12 @@ public function _exportIterateCollection($callback, array $args)
$page++;

foreach ($collection as $item) {
call_user_func_array([$this, $callback], array_merge([$item], $args));
//phpcs:ignore Magento2.Functions.DiscouragedFunction
call_user_func_array(
[$this, $callback],
// phpcs:ignore Magento2.Performance.ForeachArrayMerge
array_merge([$item], $args)
);
}
}
}
Expand Down Expand Up @@ -1009,6 +1019,7 @@ public function getCsvFile()
$this->_isExport = true;
$this->_prepareGrid();

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

Expand Down Expand Up @@ -1153,6 +1164,7 @@ public function getExcelFile($sheetName = '')
[$this, 'getRowRecord']
);

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

Expand Down Expand Up @@ -1244,7 +1256,7 @@ public function setCollection($collection)
}

/**
* get collection object
* Get collection object
*
* @return \Magento\Framework\Data\Collection
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ public function testPrepareLoadedCollection()
$layout->expects($this->any())->method('getBlock')->willReturn($columnSet);

$collection = $this->createMock(Collection::class);
$collection->expects($this->atLeastOnce())->method('isLoaded')->willReturn(true);
$collection->expects($this->atLeastOnce())->method('clear');
$collection->expects($this->never())->method('isLoaded');
$collection->expects($this->never())->method('clear');
$collection->expects($this->atLeastOnce())->method('load');

/** @var Extended $block */
Expand Down
1 change: 0 additions & 1 deletion app/code/Magento/Backend/view/adminhtml/layout/default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@
<argument name="bugreport_url" xsi:type="string">https://github.com/magento/magento2/issues</argument>
</arguments>
</block>

</container>
</container>
</referenceContainer>
Expand Down
3 changes: 1 addition & 2 deletions app/code/Magento/Backend/view/adminhtml/requirejs-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
var config = {
map: {
'*': {
'mediaUploader': 'Magento_Backend/js/media-uploader',
'mage/translate': 'Magento_Backend/js/translate'
'mediaUploader': 'Magento_Backend/js/media-uploader'
}
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminAssertBackupLinkAbsentInMenuActionGroup">
<annotations>
<description>Verify 'Backup' link is absent in admin menu.</description>
</annotations>

<click selector="{{AdminMenuSection.menuItem('magento-backend-system')}}" stepKey="clickSystem"/>
<dontSeeElement selector="{{AdminMenuSection.menuItem('magento-backup-system-tools-backup')}}" stepKey="dontSeeBackup"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="AdminSystemBackupMenuTest">
<annotations>
<features value="Backup"/>
<stories value="Backup menu not visible if config disabled"/>
<title value="Backup menu not visible if backup config disabled"/>
<description value="Disable backup config and check backup menu isn't visible"/>
<severity value="AVERAGE"/>
<testCaseId value="MC-36292"/>
<group value="backup"/>
</annotations>
<before>
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
</before>
<after>
<actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/>
</after>

<actionGroup ref="AdminAssertBackupLinkAbsentInMenuActionGroup" stepKey="verifyBackupLinkAbsentInMenu"/>
</test>
</tests>
2 changes: 1 addition & 1 deletion app/code/Magento/Backup/etc/adminhtml/menu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd">
<menu>
<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"/>
<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"/>
</menu>
</config>
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@

<!-- Save the settings -->
<scrollToTopOfPage stepKey="scrollToTop"/>
<click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveTaxOptions"/>
<waitForPageLoad stepKey="waitForTaxSaved"/>
<actionGroup ref="AdminSaveCategoryActionGroup" stepKey="saveTaxOptions"/>

<see userInput="You saved the configuration." selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="seeSuccess"/>

<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
Expand Down Expand Up @@ -192,8 +192,7 @@

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

<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Captcha/etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<depends>
<field id="enable">1</field>
</depends>
<frontend_class>required-entry</frontend_class>
<frontend_class>required-entry validate-range range-1-8</frontend_class>
</field>
<field id="symbols" translate="label comment" type="text" sortOrder="8" showInDefault="1" canRestore="1">
<label>Symbols Used in CAPTCHA</label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@
</annotations>

<click stepKey="clickOnDoneButton" selector="{{AdminProductFormAdvancedInventorySection.doneButton}}"/>
<waitForPageLoad stepKey="waitForProductPageToLoad"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@
</annotations>

<click selector="{{AdminProductFormSection.done}}" stepKey="clickOnDoneButton" />
<waitForPageLoad stepKey="waitForCategoryApply"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@
<conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/>
<fillField selector="{{AdminProductGridFilterSection.keywordSearch}}" userInput="{{keyword}}" stepKey="fillKeywordSearchField"/>
<click selector="{{AdminProductGridFilterSection.keywordSearchButton}}" stepKey="clickKeywordSearch"/>
<waitForPageLoad stepKey="waitForProductSearch"/>
</actionGroup>
</actionGroups>
4 changes: 4 additions & 0 deletions app/code/Magento/Catalog/Test/Mftf/Data/CategoryData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -265,4 +265,8 @@
<data key="level">0</data>
<var key="parent_id" entityType="category" entityKey="id"/>
</entity>
<entity name="AssignProductToCategory" type="category_product_link">
<var key="category_id" entityKey="id" entityType="category"/>
<var key="sku" entityKey="sku" entityType="product"/>
</entity>
</entities>
14 changes: 14 additions & 0 deletions app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1252,6 +1252,20 @@
<requiredEntity type="product_extension_attribute">EavStock777</requiredEntity>
<requiredEntity type="custom_attribute_array">CustomAttributeCategoryIds</requiredEntity>
</entity>
<entity name="SimpleProduct_zero" type="product">
<data key="sku" unique="suffix">testSku</data>
<data key="type_id">simple</data>
<data key="attribute_set_id">4</data>
<data key="visibility">4</data>
<data key="name" unique="suffix">testProductName</data>
<data key="price">0.00</data>
<data key="urlKey" unique="suffix">testurlkey</data>
<data key="status">1</data>
<data key="quantity">777</data>
<data key="weight">1</data>
<requiredEntity type="product_extension_attribute">EavStock777</requiredEntity>
<requiredEntity type="custom_attribute_array">CustomAttributeCategoryIds</requiredEntity>
</entity>
<entity name="ApiSimpleOneQty10" type="product2">
<data key="sku" unique="suffix">api-simple-product</data>
<data key="type_id">simple</data>
Expand Down
8 changes: 8 additions & 0 deletions app/code/Magento/Catalog/Test/Mftf/Metadata/CategoryMeta.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,12 @@
<operation name="DeleteCategory" dataType="category" type="delete" auth="adminOauth" url="/V1/categories/{id}" method="DELETE">
<contentType>application/json</contentType>
</operation>

<operation name="AssignProductToCategory" dataType="category_product_link" type="create" auth="adminOauth" url="/V1/categories/{id}/products" method="POST">
<contentType>application/json</contentType>
<object key="productLink" dataType="category_product_link">
<field key="sku">string</field>
<field key="category_id">string</field>
</object>
</operation>
</operations>
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="ProductWYSIWYGSection">
<element name="Switcher" type="button" selector="select#dropdown-switcher"/>
<element name="v436" type="button" selector="//select[@id='dropdown-switcher']/option[text()='TinyMCE 4.3.6']"/>
<element name="v3" type="button" selector="//select[@id='dropdown-switcher']/option[text()='TinyMCE 3.6(Deprecated)']"/>
<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'"/>
<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'"/>
<element name="v4910" type ="button" selector="//select[@id='dropdown-switcher']/option[text()='TinyMCE 4.9.10']" />
<element name="TinymceDescription3" type="button" selector="//span[text()='Description']"/>
<element name="SaveConfig" type="button" selector="#save"/>
<element name="v4" type="button" selector="#category_form_description_v4"/>
Expand Down
Loading

0 comments on commit 73d032f

Please sign in to comment.