Skip to content

Commit

Permalink
Merge branch '2.4-develop' into framework-EnumLookup
Browse files Browse the repository at this point in the history
  • Loading branch information
engcom-Echo authored Sep 23, 2020
2 parents 814cf2b + 390505a commit d240573
Show file tree
Hide file tree
Showing 237 changed files with 4,848 additions and 953 deletions.
10 changes: 5 additions & 5 deletions app/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
#ini_set('display_errors', 1);

/* PHP version validation */
if (!defined('PHP_VERSION_ID') || PHP_VERSION_ID < 70103) {
if (!defined('PHP_VERSION_ID') || PHP_VERSION_ID < 70300) {
if (PHP_SAPI == 'cli') {
echo 'Magento supports PHP 7.1.3 or later. ' .
'Please read https://devdocs.magento.com/guides/v2.3/install-gde/system-requirements-tech.html';
echo 'Magento supports PHP 7.3.0 or later. ' .
'Please read https://devdocs.magento.com/guides/v2.4/install-gde/system-requirements-tech.html';
} else {
echo <<<HTML
<div style="font:12px/1.35em arial, helvetica, sans-serif;">
<p>Magento supports PHP 7.1.3 or later. Please read
<a target="_blank" href="https://devdocs.magento.com/guides/v2.3/install-gde/system-requirements-tech.html">
<p>Magento supports PHP 7.3.0 or later. Please read
<a target="_blank" href="https://devdocs.magento.com/guides/v2.4/install-gde/system-requirements-tech.html">
Magento System Requirements</a>.
</div>
HTML;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
<!-- Reset admin order filter -->
<comment userInput="Reset admin order filter" stepKey="resetAdminOrderFilter"/>
<actionGroup ref="AdminOrdersGridClearFiltersActionGroup" stepKey="clearOrderFilters"/>
<waitForLoadingMaskToDisappear stepKey="waitForLoadingOrderGrid"/>
<magentoCLI command="config:set admin/dashboard/enable_charts 0" stepKey="setDisableChartsAsDefault"/>
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
Expand Down Expand Up @@ -84,8 +83,7 @@
<comment userInput="Create invoice" stepKey="createInvoice"/>

<actionGroup ref="AdminOrderGridClickFirstRowActionGroup" stepKey="clickOrderRow"/>
<click selector="{{AdminOrderDetailsMainActionsSection.invoice}}" stepKey="clickInvoiceButton"/>
<waitForPageLoad stepKey="waitForInvoicePageToLoad"/>
<actionGroup ref="AdminClickInvoiceButtonOrderViewActionGroup" stepKey="clickInvoiceButton"/>
<see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Invoice" stepKey="seeNewInvoiceInPageTitle" after="clickInvoiceButton"/>
<see selector="{{AdminInvoiceTotalSection.total('Subtotal')}}" userInput="$150.00" stepKey="seeCorrectGrandTotal"/>
<actionGroup ref="AdminInvoiceClickSubmitActionGroup" stepKey="clickSubmitInvoice"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,15 @@
<actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanCache">
<argument name="tags" value="config"/>
</actionGroup>
<magentoCLI command="setup:static-content:deploy -f" stepKey="deployStaticContent"/>
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
</before>
<after>
<magentoCLI command="config:set {{MinifyJavaScriptFilesDisableConfigData.path}} {{MinifyJavaScriptFilesDisableConfigData.value}}" stepKey="disableJsMinification"/>
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
</after>
<see userInput="Dashboard" selector="{{AdminHeaderSection.pageTitle}}" stepKey="seeDashboardTitle"/>
<waitForPageLoad stepKey="waitForPageLoadOnDashboard"/>
<see userInput="Dashboard" selector="{{AdminHeaderSection.pageTitle}}" stepKey="seeDashboardTitle"/>
<actionGroup ref="AssertAdminSuccessLoginActionGroup" stepKey="loggedInSuccessfully"/>
<actionGroup ref="AssertAdminPageIsNot404ActionGroup" stepKey="dontSee404Page"/>
</test>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,45 +4,52 @@
* See COPYING.txt for license details.
*/

/** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */
use Magento\Framework\Escaper;
use Magento\Framework\View\Helper\SecureHtmlRenderer;

/**
* @var SecureHtmlRenderer $secureRenderer
* @var Escaper $escaper
*/
?>
<!-- <?php if ($block->getTitle()): ?>
<h3><?= $block->escapeHtml($block->getTitle()) ?></h3>
<?php endif ?> -->
<?php if (!empty($tabs)): ?>
<div id="<?= $block->escapeHtmlAttr($block->getId()) ?>">
<?php $blockId = $block->getId() ?>
<div id="<?= $escaper->escapeHtmlAttr($blockId) ?>" class="hidden">
<ul class="tabs-horiz">
<?php foreach ($tabs as $_tab): ?>
<?php $tabId = $block->getTabId($_tab) ?>
<?php $_tabClass = 'tab-item-link ' . $block->getTabClass($_tab) . ' ' .
(preg_match('/\s?ajax\s?/', $_tab->getClass()) ? 'notloaded' : '') ?>
<?php $_tabType = (!preg_match('/\s?ajax\s?/', $_tabClass) && $block->getTabUrl($_tab) != '#') ? 'link' : '' ?>
<?php $_tabHref = $block->getTabUrl($_tab) == '#' ?
'#' . $block->getTabId($_tab) . '_content' :
'#' . $tabId . '_content' :
$block->getTabUrl($_tab) ?>
<li>
<a href="<?= $block->escapeUrl($_tabHref) ?>"
id="<?= $block->escapeHtmlAttr($block->getTabId($_tab)) ?>"
title="<?= $block->escapeHtmlAttr($block->getTabTitle($_tab)) ?>"
class="<?= $block->escapeHtmlAttr($_tabClass) ?>"
data-tab-type="<?= $block->escapeHtmlAttr($_tabType) ?>">
<a href="<?= $escaper->escapeUrl($_tabHref) ?>"
id="<?= $escaper->escapeHtmlAttr($tabId) ?>"
title="<?= $escaper->escapeHtmlAttr($block->getTabTitle($_tab)) ?>"
class="<?= $escaper->escapeHtmlAttr($_tabClass) ?>"
data-tab-type="<?= $escaper->escapeHtmlAttr($_tabType) ?>">
<span>
<span class="changed"
title="<?= $block->escapeHtmlAttr(__('The information in this tab has been changed.')) ?>"></span>
title="<?= $escaper->escapeHtmlAttr(__(
'The information in this tab has been changed.'
)) ?>"></span>
<span class="error"
title="<?= $block->escapeHtmlAttr(__(
title="<?= $escaper->escapeHtmlAttr(__(
'This tab contains invalid data. Please resolve this before saving.'
)) ?>"></span>
<span class="loader"
title="<?= $block->escapeHtmlAttr(__('Loading...')) ?>"></span>
<?= $block->escapeHtml($block->getTabLabel($_tab)) ?>
title="<?= $escaper->escapeHtmlAttr(__('Loading...')) ?>"></span>
<?= $escaper->escapeHtml($block->getTabLabel($_tab)) ?>
</span>
</a>
<div id="<?= $block->escapeHtmlAttr($block->getTabId($_tab)) ?>_content">
<div id="<?= $escaper->escapeHtmlAttr($tabId) ?>_content">
<?= /* @noEscape */ $block->getTabContent($_tab) ?>
</div>
<?= /* @noEscape */ $secureRenderer->renderStyleAsTag(
'display:none',
'#' . $block->escapeJs($block->getTabId($_tab)) . '_content'
'#' . $escaper->escapeJs($tabId) . '_content'
); ?>
</li>
<?php endforeach; ?>
Expand All @@ -51,11 +58,12 @@
<?php $scriptString = <<<script
require(["jquery","mage/backend/tabs"], function($){
$(function() {
$('#{$block->getId()}').tabs({
active: '{$block->getActiveTabId()}',
destination: '#{$block->getDestElementId()}',
$('#{$escaper->escapeJs($blockId)}').tabs({
active: '{$escaper->escapeJs($block->getActiveTabId())}',
destination: '#{$escaper->escapeJs($block->getDestElementId())}',
shadowTabs: {$block->getAllShadowTabs()}
});
$('#{$escaper->escapeJs($blockId)}').removeClass('hidden');
});
});
script;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@

<!--Add another bundle option with 2 items-->
<!--Go to bundle product creation page-->
<amOnPage url="{{AdminCatalogProductPage.url}}" stepKey="GoToCatalogProductPage"/>
<waitForPageLoad stepKey="WaitForPageToLoad"/>
<actionGroup ref="AdminOpenCatalogProductPageActionGroup" stepKey="goToCatalogProductPage"/>
<conditionalClick selector="{{AdminProductFiltersSection.filtersClear}}" dependentSelector="{{AdminProductFiltersSection.filtersClear}}" visible="true" stepKey="ClickOnButtonToRemoveFiltersIfPresent"/>
<waitForPageLoad stepKey="WaitForClear"/>
<actionGroup ref="FilterProductGridByNameActionGroup" stepKey="filterBundleProductOptionsDownToName">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@

<!--Testing that price appears correctly in admin catalog-->
<!--Set filter to product name-->
<amOnPage url="{{AdminCatalogProductPage.url}}" stepKey="GoToCatalogProductPage"/>
<waitForPageLoad stepKey="WaitForPageToLoad"/>
<actionGroup ref="AdminOpenCatalogProductPageActionGroup" stepKey="goToCatalogProductPage"/>
<actionGroup ref="FilterProductGridByNameActionGroup" stepKey="filterBundleProductOptionsDownToName">
<argument name="product" value="BundleProduct"/>
</actionGroup>
Expand All @@ -75,8 +74,7 @@

<!--Testing that price appears correctly in admin catalog-->
<!--Set filter to product name-->
<amOnPage url="{{AdminCatalogProductPage.url}}" stepKey="GoToCatalogProductPage2"/>
<waitForPageLoad stepKey="WaitForPageToLoad2"/>
<actionGroup ref="AdminOpenCatalogProductPageActionGroup" stepKey="goToCatalogProductPage2"/>
<actionGroup ref="FilterProductGridByNameActionGroup" stepKey="filterBundleProductOptionsDownToName2">
<argument name="product" value="BundleProduct"/>
</actionGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,7 @@
</actionGroup>

<!--Filter catalog-->
<amOnPage url="{{AdminCatalogProductPage.url}}" stepKey="goToCatalogProductPage"/>
<waitForPageLoad stepKey="WaitForPageToLoad"/>
<actionGroup ref="AdminOpenCatalogProductPageActionGroup" stepKey="goToCatalogProductPage"/>
<actionGroup ref="FilterProductGridByNameActionGroup" stepKey="filterBundleProductOptionsDownToName">
<argument name="product" value="BundleProduct"/>
</actionGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,7 @@
<actionGroup ref="AdminProductFormSaveActionGroup" stepKey="clickSaveButton"/>
<seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="messageYouSavedTheProductIsShown"/>

<!--Go to catalog deletion page-->
<amOnPage url="{{AdminCatalogProductPage.url}}" stepKey="goToCatalogPage"/>
<waitForPageLoad stepKey="Loading"/>
<actionGroup ref="AdminOpenCatalogProductPageActionGroup" stepKey="goToCatalogPage"/>

<!--Apply Name Filter-->
<actionGroup ref="FilterProductGridByNameActionGroup" stepKey="filterBundleProductOptionsDownToName">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?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="AdminDeleteBundleDynamicPriceProductTest">
<annotations>
<features value="Bundle"/>
<stories value="Delete products"/>
<title value="Delete Bundle Dynamic Product"/>
<description value="Admin should be able to delete a bundle dynamic product"/>
<severity value="CRITICAL"/>
<testCaseId value="MC-26056"/>
<group value="mtf_migrated"/>
<group value="bundle"/>
</annotations>
<before>
<!-- Create category and simple product -->
<createData entity="SimpleSubCategory" stepKey="createCategory"/>
<createData entity="SimpleProduct2" stepKey="createSimpleProduct"/>

<!-- Create bundle product -->
<createData entity="ApiBundleProductPriceViewRange" stepKey="createDynamicBundleProduct">
<requiredEntity createDataKey="createCategory"/>
</createData>
<createData entity="DropDownBundleOption" stepKey="bundleOption">
<requiredEntity createDataKey="createDynamicBundleProduct"/>
</createData>
<createData entity="ApiBundleLink" stepKey="createNewBundleLink">
<requiredEntity createDataKey="createDynamicBundleProduct"/>
<requiredEntity createDataKey="bundleOption"/>
<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>
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
</before>
<after>
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
<deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/>
<magentoCron groups="index" stepKey="reindexInvalidatedIndices"/>
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
</after>
<actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteBundleProductBySku">
<argument name="sku" value="$createDynamicBundleProduct.sku$"/>
</actionGroup>
<!-- Verify product on Product Page -->
<amOnPage url="{{StorefrontProductPage.url($createDynamicBundleProduct.custom_attributes[url_key]$)}}" stepKey="openBundleProductPage"/>
<see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="Whoops, our bad..." stepKey="seeWhoopsMessage"/>
<!-- Search for the product by sku -->
<actionGroup ref="StoreFrontQuickSearchActionGroup" stepKey="searchBySku">
<argument name="query" value="$createDynamicBundleProduct.sku$"/>
</actionGroup>
<!-- Should not see bundle product -->
<dontSee userInput="$createDynamicBundleProduct.sku$" selector="{{StorefrontCatalogSearchMainSection.searchResults}}" stepKey="dontSeeProduct"/>
<amOnPage url="{{StorefrontCategoryPage.url($createCategory.custom_attributes[url_key]$)}}" stepKey="openCategoryPage"/>
<!-- Should not see any products in category -->
<dontSee userInput="$createDynamicBundleProduct.name$" selector="{{StorefrontCategoryMainSection.productsList}}" stepKey="dontSeeProductInCategory"/>
<see selector="{{StorefrontCategoryMainSection.emptyProductMessage}}" userInput="We can't find products matching the selection." stepKey="seeEmptyProductMessage"/>
</test>
</tests>
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
-->
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="AdminDeleteBundleDynamicProductTest">
<test name="AdminDeleteBundleDynamicProductTest" deprecated="Use AdminDeleteBundleDynamicPriceProductTest instead">
<annotations>
<features value="Bundle"/>
<stories value="Delete products"/>
<title value="Delete Bundle Dynamic Product"/>
<description value="Admin should be able to delete a bundle dynamic product"/>
<title value="Deprecated. Delete Bundle Dynamic Product"/>
<description value="Deprecated. Admin should be able to delete a bundle dynamic product"/>
<severity value="CRITICAL"/>
<testCaseId value="MC-11016"/>
<group value="mtf_migrated"/>
<skip>
<issueId value="MC-16393"/>
<issueId value="DEPRECATED">Use AdminDeleteBundleDynamicPriceProductTest instead</issueId>
</skip>
</annotations>
<before>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@

<!--Testing that price appears correctly in admin catalog-->
<!--Set filter to product name-->
<amOnPage url="{{AdminCatalogProductPage.url}}" stepKey="GoToCatalogProductPage"/>
<waitForPageLoad stepKey="WaitForPageToLoad"/>
<actionGroup ref="AdminOpenCatalogProductPageActionGroup" stepKey="goToCatalogProductPage"/>
<conditionalClick selector="{{AdminProductFiltersSection.filtersClear}}" dependentSelector="{{AdminProductFiltersSection.filtersClear}}" visible="true" stepKey="ClickOnButtonToRemoveFiltersIfPresent"/>
<waitForPageLoad stepKey="WaitForClear"/>
<actionGroup ref="FilterProductGridByNameActionGroup" stepKey="filterBundleProductOptionsDownToName">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@
<after>
<actionGroup ref="AdminLogoutActionGroup" stepKey="amOnLogoutPage"/>
</after>
<amOnPage url="{{AdminCatalogProductPage.url}}" stepKey="GoToCatalogProductPage"/>
<waitForPageLoad stepKey="WaitForPageToLoad"/>
<actionGroup ref="AdminOpenCatalogProductPageActionGroup" stepKey="goToCatalogProductPage"/>
<!--Selecting new bundle product-->
<actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateBundleProduct">
<argument name="product" value="BundleProduct"/>
Expand Down
13 changes: 12 additions & 1 deletion app/code/Magento/Catalog/Model/Product/Gallery/CreateHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -596,10 +596,21 @@ private function canRemoveImage(ProductInterface $product, string $imageFile) :b
$canRemoveImage = true;
$gallery = $this->getImagesForAllStores($product);
$storeId = $product->getStoreId();
$storeIds = [];
$storeIds[] = 0;
$websiteIds = array_map('intval', $product->getWebsiteIds() ?? []);
foreach ($this->storeManager->getStores() as $store) {
if (in_array((int) $store->getWebsiteId(), $websiteIds, true)) {
$storeIds[] = (int) $store->getId();
}
}

if (!empty($gallery)) {
foreach ($gallery as $image) {
if ($image['filepath'] === $imageFile && (int) $image['store_id'] !== $storeId) {
if (in_array((int) $image['store_id'], $storeIds)
&& $image['filepath'] === $imageFile
&& (int) $image['store_id'] !== $storeId
) {
$canRemoveImage = false;
}
}
Expand Down
Loading

0 comments on commit d240573

Please sign in to comment.