Skip to content

Commit

Permalink
Merge branch '2.4-develop' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
engcom-Charlie authored Dec 22, 2020
2 parents 4b007c2 + 661c15c commit 0e58811
Show file tree
Hide file tree
Showing 451 changed files with 13,164 additions and 4,209 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,8 @@ private function fetchTierPrices(array $productIds): array
)
->where(
'ap.' . $productEntityLinkField . ' IN (?)',
$productIds
$productIds,
\Zend_Db::INT_TYPE
);

if ($priceFromFilter !== null) {
Expand Down
8 changes: 7 additions & 1 deletion app/code/Magento/Backend/App/Area/FrontNameResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,13 @@ public function isHostBackend()
if ($this->scopeConfig->getValue(self::XML_PATH_USE_CUSTOM_ADMIN_URL, ScopeInterface::SCOPE_STORE)) {
$backendUrl = $this->scopeConfig->getValue(self::XML_PATH_CUSTOM_ADMIN_URL, ScopeInterface::SCOPE_STORE);
} else {
$backendUrl = $this->scopeConfig->getValue(Store::XML_PATH_UNSECURE_BASE_URL, ScopeInterface::SCOPE_STORE);
$backendUrl = $this->config->getValue(Store::XML_PATH_UNSECURE_BASE_URL);
if ($backendUrl === null) {
$backendUrl = $this->scopeConfig->getValue(
Store::XML_PATH_UNSECURE_BASE_URL,
ScopeInterface::SCOPE_STORE
);
}
}
$host = $this->request->getServer('HTTP_HOST', '');
return stripos($this->getHostWithPort($backendUrl), (string) $host) !== false;
Expand Down
5 changes: 4 additions & 1 deletion app/code/Magento/Backend/Block/Widget/Button.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
*/
namespace Magento\Backend\Block\Widget;

use Magento\Backend\Block\Template\Context;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\Math\Random;
use Magento\Backend\Block\Template\Context;
use Magento\Framework\View\Helper\SecureHtmlRenderer;

/**
Expand Down Expand Up @@ -125,6 +125,9 @@ protected function _prepareAttributes($title, $classes, $disabled)
'value' => $this->getValue(),
'disabled' => $disabled,
];
if ($this->hasData('onclick_attribute')) {
$attributes['onclick'] = $this->getData('onclick_attribute');
}
if ($this->hasData('backend_button_widget_hook_id')) {
$attributes['backend-button-widget-hook-id'] = $this->getData('backend_button_widget_hook_id');
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?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="AssertLinkActionGroup">
<annotations>
<description>Assert text and url of the links.</description>
</annotations>
<arguments>
<argument name="text" type="string"/>
<argument name="url" type="string"/>
</arguments>

<seeLink userInput="{{text}}" url="{{url}}" stepKey="assertLinks"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
<after>
<!-- 6. Restore default configuration settings. -->
<magentoCLI command="config:set {{DefaultWebCookieLifetimeConfigData.path}} {{DefaultWebCookieLifetimeConfigData.value}}" stepKey="setDefaultCookieLifetime"/>
<!-- Customer Log Out -->
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="customerLogout"/>
<!-- Delete data -->
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
Expand Down
59 changes: 40 additions & 19 deletions app/code/Magento/Backend/Test/Mftf/Test/AdminPrivacyPolicyTest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,70 +23,91 @@
<!-- Logging in Magento admin and checking for Privacy policy footer in dashboard -->
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
<closeAdminNotification stepKey="closeAdminNotification"/>
<seeLink userInput="Privacy Policy" url="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf" stepKey="seePrivacyPolicyLinkDashboard"/>

<actionGroup ref="AssertLinkActionGroup" stepKey="seePrivacyPolicyLinkDashboard">
<argument name="text" value="Privacy Policy"/>
<argument name="url" value="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf"/>
</actionGroup>
<!-- Checking for Privacy policy footer in salesOrderPage -->
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToSalesOrder">
<argument name="menuUiId" value="magento-sales-sales"/>
<argument name="submenuUiId" value="magento-sales-sales-order"/>
</actionGroup>
<seeLink userInput="Privacy Policy" url="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf" stepKey="seePrivacyPolicyLinkSalesOrder"/>

<actionGroup ref="AssertLinkActionGroup" stepKey="seePrivacyPolicyLinkSalesOrder">
<argument name="text" value="Privacy Policy"/>
<argument name="url" value="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf"/>
</actionGroup>
<!-- Checking for Privacy policy footer in catalogProductsPage -->
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToCatalogProducts">
<argument name="menuUiId" value="magento-catalog-catalog"/>
<argument name="submenuUiId" value="magento-catalog-catalog-products"/>
</actionGroup>
<seeLink userInput="Privacy Policy" url="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf" stepKey="seePrivacyPolicyLinkCatalogProducts"/>

<actionGroup ref="AssertLinkActionGroup" stepKey="seePrivacyPolicyLinkCatalogProducts">
<argument name="text" value="Privacy Policy"/>
<argument name="url" value="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf"/>
</actionGroup>
<!-- Checking for Privacy policy footer in customersAllCustomersPage -->
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToCustomersAllCustomers">
<argument name="menuUiId" value="magento-customer-customer"/>
<argument name="submenuUiId" value="magento-customer-customer-manage"/>
</actionGroup>
<seeLink userInput="Privacy Policy" url="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf" stepKey="seePrivacyPolicyLinkCustomersAllCustomers"/>

<actionGroup ref="AssertLinkActionGroup" stepKey="seePrivacyPolicyLinkCustomersAllCustomers">
<argument name="text" value="Privacy Policy"/>
<argument name="url" value="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf"/>
</actionGroup>
<!-- Checking for Privacy policy footer in marketingCatalogPriceRulePage -->
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToMarketingCatalogPriceRule">
<argument name="menuUiId" value="magento-backend-marketing"/>
<argument name="submenuUiId" value="magento-catalogrule-promo-catalog"/>
</actionGroup>
<seeLink userInput="Privacy Policy" url="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf" stepKey="seePrivacyPolicyLinkMarketingCatalogPriceRule"/>

<actionGroup ref="AssertLinkActionGroup" stepKey="seePrivacyPolicyLinkMarketingCatalogPriceRule">
<argument name="text" value="Privacy Policy"/>
<argument name="url" value="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf"/>
</actionGroup>
<!-- Checking for Privacy policy footer in contentBlocksPage -->
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToContentBlocks">
<argument name="menuUiId" value="magento-backend-content"/>
<argument name="submenuUiId" value="magento-cms-cms-block"/>
</actionGroup>
<seeLink userInput="Privacy Policy" url="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf" stepKey="seePrivacyPolicyLinkContentBlocks"/>

<actionGroup ref="AssertLinkActionGroup" stepKey="seePrivacyPolicyLinkContentBlocks">
<argument name="text" value="Privacy Policy"/>
<argument name="url" value="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf"/>
</actionGroup>
<!-- Checking for Privacy policy footer in reportSearcbTermsPage -->
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToReportsSearchTerms">
<argument name="menuUiId" value="magento-reports-report"/>
<argument name="submenuUiId" value="magento-search-report-search-term"/>
</actionGroup>
<seeLink userInput="Privacy Policy" url="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf" stepKey="seePrivacyPolicyLinkReportsSearchTerms"/>

<actionGroup ref="AssertLinkActionGroup" stepKey="seePrivacyPolicyLinkReportsSearchTerms">
<argument name="text" value="Privacy Policy"/>
<argument name="url" value="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf"/>
</actionGroup>
<!-- Checking for Privacy policy footer in storesAllStoresPage -->
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToStoresAllStores">
<argument name="menuUiId" value="magento-backend-stores"/>
<argument name="submenuUiId" value="magento-backend-system-store"/>
</actionGroup>
<seeLink userInput="Privacy Policy" url="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf" stepKey="seePrivacyPolicyLinkStoresAllStores"/>

<actionGroup ref="AssertLinkActionGroup" stepKey="seePrivacyPolicyLinkStoresAllStores">
<argument name="text" value="Privacy Policy"/>
<argument name="url" value="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf"/>
</actionGroup>
<!-- Checking for Privacy policy footer in systemImportPage -->
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToSystemImport">
<argument name="menuUiId" value="magento-backend-system"/>
<argument name="submenuUiId" value="magento-importexport-system-convert-import"/>
</actionGroup>
<seeLink userInput="Privacy Policy" url="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf" stepKey="seePrivacyPolicyLinkSystemImport"/>

<actionGroup ref="AssertLinkActionGroup" stepKey="seePrivacyPolicyLinkSystemImport">
<argument name="text" value="Privacy Policy"/>
<argument name="url" value="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf"/>
</actionGroup>
<!-- Checking for Privacy policy footer in findPartnersAndExtensionsPage -->
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToFindPartnersAndExtensions">
<argument name="menuUiId" value="magento-marketplace-partners"/>
<argument name="submenuUiId" value="magento-marketplace-partners"/>
</actionGroup>
<seeLink userInput="Privacy Policy" url="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf" stepKey="seePrivacyPolicyLinkFindPartnersAndExtensions"/>
<actionGroup ref="AssertLinkActionGroup" stepKey="seePrivacyPolicyLinkFindPartnersAndExtensions">
<argument name="text" value="Privacy Policy"/>
<argument name="url" value="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf"/>
</actionGroup>
</test>
</tests>

Expand Down
12 changes: 12 additions & 0 deletions app/code/Magento/Backend/Test/Unit/Block/Widget/ButtonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,16 @@ public function getAttributesHtmlDataProvider()
]
];
}

/**
* Verifies ability of adding button onclick attribute
*
* @return void
*/
public function testOnClickAttribute(): void
{
$this->_blockMock->setData(['onclick_attribute' => 'value']);
$attributes = $this->_blockMock->getAttributesHtml();
$this->assertStringContainsString('onclick', $attributes);
}
}
3 changes: 2 additions & 1 deletion app/code/Magento/Bundle/Model/ResourceModel/Selection.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ public function getParentIdsByChild($childId)
['e.entity_id as parent_product_id']
)->where(
$this->getMainTable() . '.product_id IN(?)',
$childId
$childId,
\Zend_Db::INT_TYPE
);

return $connection->fetchCol($select);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,7 @@
<requiredEntity createDataKey="createSimpleProduct"/>
</createData>

<!-- Reindex -->
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
<argument name="indices" value=""/>
</actionGroup>
<comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/>

<!-- Login as admin -->
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@
<requiredEntity createDataKey="createSimpleProduct"/>
</createData>
<!-- TODO: Remove this action when MC-37719 will be fixed -->
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindexInvalidatedIndices">
<argument name="indices" value="cataloginventory_stock"/>
</actionGroup>
<comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindexInvalidatedIndices"/>
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
</before>
<after>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,7 @@
<click selector="{{AdminProductFiltersSection.enable}}" stepKey="ClickOnEnable"/>

<!--Clear Cache - reindex - resets products according to enabled/disabled view-->
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
<argument name="indices" value=""/>
</actionGroup>
<comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/>
<actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache">
<argument name="tags" value=""/>
</actionGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<requiredEntity createDataKey="apiSimple"/>
</createData>
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
<argument name="indices" value=""/>
<argument name="indices" value="cataloginventory_stock catalog_product_price"/>
</actionGroup>
</before>
<after>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@
<argument name="productId" value="$createFixedBundleProduct.id$"/>
</actionGroup>
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/>
<!--Perform reindex and flush cache-->
<actionGroup ref="AdminReindexAndFlushCache" stepKey="reindexAndFlushCache"/>
<comment userInput="Adding the comment to replace AdminReindexAndFlushCache action group ('indexer:reindex', 'cache:flush' commands) for preserving Backward Compatibility" stepKey="reindexAndFlushCache"/>
</before>
<after>
<deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProductForBundleItem"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@
<requiredEntity createDataKey="fixedBundleOption"/>
<requiredEntity createDataKey="createSimpleProductTwo"/>
</createData>

<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
<argument name="indices" value=""/>
<argument name="indices" value="cataloginventory_stock catalog_product_price"/>
</actionGroup>
</before>
<after>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@

<!-- Perform CLI reindex -->
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
<argument name="indices" value=""/>
<argument name="indices" value="cataloginventory_stock catalog_product_price"/>
</actionGroup>
</before>
<after>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
<see userInput="You saved the configuration." selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="seeSuccess"/>

<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
<argument name="indices" value=""/>
<argument name="indices" value="cataloginventory_stock catalog_product_price"/>
</actionGroup>
</before>
<after>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<argument name="tags" value="full_page"/>
</actionGroup>
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="indexerReindexAfterCreate">
<argument name="indices" value=""/>
<argument name="indices" value="catalog_product_price"/>
</actionGroup>

<!-- Check Bundle product is visible on the storefront-->
Expand All @@ -63,9 +63,7 @@
<actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCacheAfterUpdate">
<argument name="tags" value="full_page"/>
</actionGroup>
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="indexerReindexAfterUpdate">
<argument name="indices" value=""/>
</actionGroup>
<comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="indexerReindexAfterUpdate"/>

<!-- Check Bundle product is still visible on the storefront-->
<actionGroup ref="StorefrontGoToCategoryPageActionGroup" stepKey="openCategoryPageAfterUpdate">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,15 +209,22 @@ public function getImagesJson()
*/
private function sortImagesByPosition($images)
{
if (is_array($images)) {
$nullPositions = [];
foreach ($images as $index => $image) {
if ($image['position'] === null) {
$nullPositions[] = $image;
unset($images[$index]);
}
}
if (is_array($images) && !empty($images)) {
usort(
$images,
function ($imageA, $imageB) {
return ($imageA['position'] < $imageB['position']) ? -1 : 1;
}
);
}
return $images;
return array_merge($images, $nullPositions);
}

/**
Expand Down
Loading

0 comments on commit 0e58811

Please sign in to comment.