Skip to content

Commit

Permalink
🔃 [Magento Community Engineering] Community Contributions - 2.4-devel…
Browse files Browse the repository at this point in the history
…op latest changes

Accepted Community Pull Requests:
 - #29947: #1801: User is not scrolled up to the "Login failed. Please check if the Secret Key..." error, and can miss the message (by @yolouiese)
 - #27391: magento/magento2#: Add a new index for `cron_schedule` table (by @atwixfirster)
 - #29906: fix category image is not removed from tmp folder after category save (by @engcom-Golf)
 - #27602: Order Invoice create page doesn't show order items properly for bundle product Fixed Issue #27350 (by @gauravagarwal1001)
 - #27832: Old price excluding TAX shown correct on Product Page (by @Krielkip)
 - #29925: Fix #29879 Breadcrump Undefined class constant 'XML_PATH_CATEGORY_URL_SUFFIX' (by @toxix)
 - #29006: Unable to insert widget with text value which contains }} string (by @engcom-Kilo)
 - #29863: Fixed critical error: The following tag(s) are not allowed: img (by @themystery404)
 - #28687: clear errors when apply new filters (by @AbdulRahmanAbouzaid)
 - #26877: Product not exist fix when attempt to get an image (by @ilnytskyi)


Fixed GitHub Issues:
 - #29601: [Issue] magento/magento2#: Add a new index for `cron_schedule` table (reported by @m2-assistant[bot]) has been fixed in #27391 by @atwixfirster in 2.4-develop branch
   Related commits:
     1. 652971e
     2. 24d7a8a

 - #27350: Order Invoice create page doesn't show order items properly for bundle product (reported by @webkul-ajaysaini) has been fixed in #27602 by @gauravagarwal1001 in 2.4-develop branch
   Related commits:
     1. 2f8b560
     2. 51fcc42
     3. 0591d51
     4. 140c351
     5. 699c98f

 - #11998: Old price excluding TAX is incorrectly replaced by JavaScript (reported by @VesnaS) has been fixed in #27832 by @Krielkip in 2.4-develop branch
   Related commits:
     1. 65c06eb
     2. 7f4b276
     3. 21ad13f
     4. 8f1020a
     5. cfb762d
     6. c6a43f3
     7. 84124f7
     8. 43b4f64
     9. 9fd5436

 - #27500: Unit Tests incompatible with PHPUnit 8 (reported by @lbajsarowicz) has been fixed in #27832 by @Krielkip in 2.4-develop branch
   Related commits:
     1. 65c06eb
     2. 7f4b276
     3. 21ad13f
     4. 8f1020a
     5. cfb762d
     6. c6a43f3
     7. 84124f7
     8. 43b4f64
     9. 9fd5436

 - #28981: [Issue] Fixed 'Undefined class constant' error when interceptor is generated. (reported by @m2-assistant[bot]) has been fixed in #29925 by @toxix in 2.4-develop branch
   Related commits:
     1. 2d1d097

 - #29879: Late Static Binding on private constants in Magento\Catalog\ViewModel\Product\Breadcrumbs (reported by @Cheeerd) has been fixed in #29925 by @toxix in 2.4-develop branch
   Related commits:
     1. 2d1d097

 - #12087: Unable to insert widget with text value which contains }} string (reported by @ghost) has been fixed in #29006 by @engcom-Kilo in 2.4-develop branch
   Related commits:
     1. 7f0f260
     2. 2a48abe
     3. e0eb4b0
     4. cb0b3d4
     5. 1f84319
     6. f55eeb4
     7. ae3d3df
     8. a2346f4
     9. 74325ef
     10. 0ac2e5d
     11. edd3401
     12. ace8a6f
     13. 01b7906

 - #29958: [Issue] Fixed critical error: The following tag(s) are not allowed: img (reported by @m2-assistant[bot]) has been fixed in #29863 by @themystery404 in 2.4-develop branch
   Related commits:
     1. 798e61f
     2. 0472281

 - #8538: No ability to reset filters after an error (reported by @spyrule) has been fixed in #28687 by @AbdulRahmanAbouzaid in 2.4-develop branch
   Related commits:
     1. 674324c
     2. 9fac5f7
     3. 3852c89
     4. 7517b21
     5. cef2186

 - #26876: Error when sending sales mails in async mode if product was removed (reported by @ilnytskyi) has been fixed in #26877 by @ilnytskyi in 2.4-develop branch
   Related commits:
     1. 405dfec
     2. f8a5126
     3. da38103
  • Loading branch information
magento-engcom-team authored Sep 10, 2020
2 parents 4003ee5 + 949b3da commit 5cd4345
Show file tree
Hide file tree
Showing 35 changed files with 645 additions and 112 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<?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="StorefrontBundlePlaceOrderWithMultipleOptionsSuccessTest">
<annotations>
<features value="Bundle"/>
<stories value="Bundle product details page"/>
<title value="Customer should be able to see all the bundle items in invoice view"/>
<description value="Customer should be able to see all the bundle items in invoice view"/>
<severity value="MAJOR"/>
<testCaseId value="MC-37515"/>
<group value="Bundle"/>
</annotations>
<before>
<createData entity="_defaultCategory" stepKey="createPreReqCategory"/>
<createData entity="SimpleProduct2" stepKey="firstSimpleProduct"/>
<createData entity="SimpleProduct2" stepKey="secondSimpleProduct"/>
<createData entity="CustomerEntityOne" stepKey="createCustomer"/>
<actionGroup stepKey="loginToAdminPanel" ref="AdminLoginActionGroup"/>
</before>
<after>
<deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCategory"/>
<deleteData createDataKey="firstSimpleProduct" stepKey="deleteFirstSimpleProduct"/>
<deleteData createDataKey="secondSimpleProduct" stepKey="deleteSecondSimpleProduct"/>
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
</after>
<!-- Create new bundle product -->
<actionGroup ref="GoToSpecifiedCreateProductPageActionGroup" stepKey="createBundleProduct">
<argument name="productType" value="bundle"/>
</actionGroup>

<!-- Fill all main fields -->
<actionGroup ref="FillMainBundleProductFormActionGroup" stepKey="fillMainProductFields"/>

<!-- Add first bundle option to the product -->
<actionGroup ref="AddBundleOptionWithTwoProductsActionGroup" stepKey="addFirstBundleOption">
<argument name="x" value="0"/>
<argument name="n" value="1"/>
<argument name="prodOneSku" value="$firstSimpleProduct.sku$"/>
<argument name="prodTwoSku" value="$secondSimpleProduct.sku$$"/>
<argument name="optionTitle" value="{{CheckboxOption.title}}"/>
<argument name="inputType" value="{{CheckboxOption.type}}"/>
</actionGroup>

<!-- Save product form -->
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveWithThreeOptions"/>

<!--Login customer on storefront-->
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginCustomer">
<argument name="Customer" value="$$createCustomer$$" />
</actionGroup>

<!--Open Product Page-->
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openStorefrontProductPage">
<argument name="productUrl" value="{{BundleProduct.name}}"/>
</actionGroup>

<!-- Add bundle to cart -->
<actionGroup ref="StorefrontSelectCustomizeAndAddToTheCartButtonActionGroup" stepKey="clickAddToCart">
<argument name="productUrl" value="{{BundleProduct.name}}"/>
</actionGroup>
<checkOption selector="{{StorefrontBundledSection.checkboxOptionThreeProducts(CheckboxOption.title, '1')}}" stepKey="selectOption2Product1"/>
<checkOption selector="{{StorefrontBundledSection.checkboxOptionThreeProducts(CheckboxOption.title, '2')}}" stepKey="selectOption2Product2"/>
<actionGroup ref="StorefrontEnterProductQuantityAndAddToTheCartActionGroup" stepKey="enterProductQuantityAndAddToTheCart">
<argument name="quantity" value="1"/>
</actionGroup>

<!--Navigate to checkout-->
<actionGroup ref="StorefrontOpenCheckoutPageActionGroup" stepKey="openCheckoutPage"/>
<!-- Click next button to open payment section -->
<actionGroup ref="StorefrontCheckoutClickNextButtonActionGroup" stepKey="clickNext"/>
<!-- Click place order -->
<actionGroup ref="ClickPlaceOrderActionGroup" stepKey="placeOrder"/>
<grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber22}}" stepKey="grabOrderNumber"/>

<!-- Order review page has address that was created during checkout -->
<actionGroup ref="OpenOrderByIdActionGroup" stepKey="filterOrdersGridById">
<argument name="orderId" value="{$grabOrderNumber}"/>
</actionGroup>

<!-- Open create invoice page -->
<actionGroup ref="StartCreateInvoiceFromOrderPageActionGroup" stepKey="startInvoice"/>

<!-- Assert item options display -->
<see selector="{{AdminInvoiceItemsSection.bundleItem}}" userInput="50 x $firstSimpleProduct.sku$" stepKey="seeFirstProductInList"/>
<see selector="{{AdminInvoiceItemsSection.bundleItem}}" userInput="50 x $secondSimpleProduct.sku$" stepKey="seeSecondProductInList"/>
</test>
</tests>
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<?php $items = $block->getChildren($_item); ?>
<?php $_count = count($items) ?>
<?php $_index = 0 ?>
<?php $canEditItemQty = true ?>
<?php
/** @var \Magento\Catalog\Helper\Data $catalogHelper */
$catalogHelper = $block->getData('catalogHelper');
Expand All @@ -37,7 +38,7 @@ $catalogHelper = $block->getData('catalogHelper');
<?php if ($_item->getOrderItem()->getParentItem()): ?>
<?php
if ($shipTogether) {
continue;
$canEditItemQty = false;
}
?>
<?php $attributes = $block->getSelectionAttributes($_item) ?>
Expand Down Expand Up @@ -130,7 +131,7 @@ $catalogHelper = $block->getData('catalogHelper');
</td>
<td class="col-qty-invoice">
<?php if ($block->canShowPriceInfo($_item) || $shipTogether): ?>
<?php if ($block->canEditQty()): ?>
<?php if ($block->canEditQty() && $canEditItemQty): ?>
<input type="text"
class="input-text admin__control-text qty-input"
name="invoice[items][<?= $block->escapeHtmlAttr($_item->getOrderItemId()) ?>]"
Expand Down
4 changes: 4 additions & 0 deletions app/code/Magento/Catalog/Block/Product/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,10 @@ public function getJsonConfig()
'productId' => (int)$product->getId(),
'priceFormat' => $this->_localeFormat->getPriceFormat(),
'prices' => [
'baseOldPrice' => [
'amount' => $priceInfo->getPrice('regular_price')->getAmount()->getBaseAmount() * 1,
'adjustments' => []
],
'oldPrice' => [
'amount' => $priceInfo->getPrice('regular_price')->getAmount()->getValue() * 1,
'adjustments' => []
Expand Down
8 changes: 7 additions & 1 deletion app/code/Magento/Catalog/Helper/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,9 @@ public function backgroundColor($colorRGB)
{
// assume that 3 params were given instead of array
if (!is_array($colorRGB)) {
//phpcs:disable
$colorRGB = func_get_args();
//phpcs:enabled
}
$this->_getModel()->setBackgroundColor($colorRGB);
return $this;
Expand Down Expand Up @@ -498,7 +500,11 @@ protected function initBaseFile()
if ($this->getImageFile()) {
$model->setBaseFile($this->getImageFile());
} else {
$model->setBaseFile($this->getProduct()->getData($model->getDestinationSubdir()));
$model->setBaseFile(
$this->getProduct()
? $this->getProduct()->getData($model->getDestinationSubdir())
: ''
);
}
}
return $this;
Expand Down
8 changes: 8 additions & 0 deletions app/code/Magento/Catalog/Test/Unit/Helper/ImageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,14 @@ public function testGetWidth()
$this->assertEquals($data['width'], $this->helper->getWidth());
}

/**
* Check initBaseFile without properties - product
*/
public function testGetUrlWithOutProduct()
{
$this->assertNull($this->helper->getUrl());
}

/**
* @param array $data
* @dataProvider getHeightDataProvider
Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/Catalog/ViewModel/Product/Breadcrumbs.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function __construct(
public function getCategoryUrlSuffix()
{
return $this->scopeConfig->getValue(
static::XML_PATH_CATEGORY_URL_SUFFIX,
self::XML_PATH_CATEGORY_URL_SUFFIX,
ScopeInterface::SCOPE_STORE
);
}
Expand All @@ -84,7 +84,7 @@ public function getCategoryUrlSuffix()
public function isCategoryUsedInProductUrl(): bool
{
return $this->scopeConfig->isSetFlag(
static::XML_PATH_PRODUCT_USE_CATEGORIES,
self::XML_PATH_PRODUCT_USE_CATEGORIES,
ScopeInterface::SCOPE_STORE
);
}
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="AdminFillCatalogProductsListWidgetTitleActionGroup">
<annotations>
<description>Fill catalog products list title field.</description>
</annotations>

<arguments>
<argument name="title" type="string" defaultValue=""/>
</arguments>
<waitForElementVisible selector="{{InsertWidgetSection.title}}" stepKey="waitForField"/>
<fillField selector="{{InsertWidgetSection.title}}" userInput="{{title}}" stepKey="fillTitleField"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?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="StorefrontAssertWidgetTitleActionGroup">
<annotations>
<description>Assert widget title on storefront.</description>
</annotations>
<arguments>
<argument name="title" type="string"/>
</arguments>

<grabTextFrom selector="{{StorefrontWidgetsSection.widgetProductsGrid}} {{StorefrontWidgetsSection.widgetTitle}}"
stepKey="grabWidgetTitle"/>
<assertEquals stepKey="assertWidgetTitle">
<actualResult type="string">$grabWidgetTitle</actualResult>
<expectedResult type="string">{{title}}</expectedResult>
</assertEquals>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@
<element name="checkElementStorefrontByPrice" type="button" selector="//*[@class='product-items widget-product-grid']//*[contains(text(),'${{arg4}}.00')]" parameterized="true"/>
<element name="checkElementStorefrontByName" type="button" selector="//*[@class='product-items widget-product-grid']//*[@class='product-item'][{{productPosition}}]//a[contains(text(), '{{productName}}')]" parameterized="true"/>
<element name="categoryTreeWrapper" type="text" selector=".rule-chooser .tree.x-tree"/>
<element name="title" type="text" selector="input[name='parameters[title]']"/>
</section>
</sections>
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?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="StoreFrontWidgetTitleWithReservedCharsTest">
<annotations>
<features value="Cms"/>
<stories value="Create a CMS Page via the Admin when widget title contains reserved chairs"/>
<title value="Create CMS Page via the Admin when widget title contains reserved chairs"/>
<description value="See CMS Page title on store front page if titled widget with reserved chairs added"/>
<severity value="MAJOR"/>
<testCaseId value="MC-37419"/>
<group value="Cms"/>
<group value="WYSIWYGDisabled"/>
</annotations>
<before>
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
<createData entity="simpleProductWithoutCategory" stepKey="createSimpleProductWithoutCategory"/>
<createData entity="_defaultCmsPage" stepKey="createCmsPage"/>
</before>
<after>
<deleteData createDataKey="createSimpleProductWithoutCategory" stepKey="deleteProduct"/>
<deleteData createDataKey="createCmsPage" stepKey="deleteCmsPage" />
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
</after>
<!--Navigate to Page in Admin-->
<actionGroup ref="NavigateToCreatedCMSPageActionGroup" stepKey="navigateToCreatedCMSPage">
<argument name="CMSPage" value="$createCmsPage$"/>
</actionGroup>
<!--Insert widget-->
<actionGroup ref="AdminInsertWidgetToCmsPageContentActionGroup" stepKey="insertWidgetToCmsPageContent">
<argument name="widgetType" value="Catalog Products List"/>
</actionGroup>
<!--Fill widget title and save-->
<actionGroup ref="AdminFillCatalogProductsListWidgetTitleActionGroup" stepKey="fillWidgetTitle">
<argument name="title" value="Tittle }}"/>
</actionGroup>
<actionGroup ref="AdminClickInsertWidgetActionGroup" stepKey="clickInsertWidgetButton"/>
<actionGroup ref="SaveCmsPageActionGroup" stepKey="saveOpenedPage"/>
<!--Verify data on frontend-->
<actionGroup ref="StorefrontGoToCMSPageActionGroup" stepKey="navigateToPageOnStorefront">
<argument name="identifier" value="$createCmsPage.identifier$"/>
</actionGroup>
<actionGroup ref="StorefrontAssertWidgetTitleActionGroup" stepKey="verifyPageDataOnFrontend">
<argument name="title" value="Tittle }}"/>
</actionGroup>
</test>
</tests>
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,11 @@ protected function getOptionPrices()

$prices[$product->getId()] =
[
'baseOldPrice' => [
'amount' => $this->localeFormat->getNumber(
$priceInfo->getPrice('regular_price')->getAmount()->getBaseAmount()
),
],
'oldPrice' => [
'amount' => $this->localeFormat->getNumber(
$priceInfo->getPrice('regular_price')->getAmount()->getValue()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ public function getFormattedPrices(\Magento\Framework\Pricing\PriceInfo\Base $pr
$finalPrice = $priceInfo->getPrice('final_price');

return [
'baseOldPrice' => [
'amount' => $this->localeFormat->getNumber($regularPrice->getAmount()->getBaseAmount()),
],
'oldPrice' => [
'amount' => $this->localeFormat->getNumber($regularPrice->getAmount()->getValue()),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,11 @@ public function cacheKeyProvider(): array
* @param string|null $priceCurrency
* @param int|null $customerGroupId
*/
public function testGetCacheKeyInfo(array $expected, ?string $priceCurrency = null, ?int $customerGroupId = null)
{
public function testGetCacheKeyInfo(
array $expected,
?string $priceCurrency = null,
?int $customerGroupId = null
): void {
$storeMock = $this->getMockBuilder(StoreInterface::class)
->setMethods(['getCurrentCurrency'])
->getMockForAbstractClass();
Expand All @@ -282,7 +285,7 @@ public function testGetCacheKeyInfo(array $expected, ?string $priceCurrency = nu
/**
* Check that getJsonConfig() method returns expected value
*/
public function testGetJsonConfig()
public function testGetJsonConfig(): void
{
$productId = 1;
$amount = 10.50;
Expand Down Expand Up @@ -347,6 +350,9 @@ public function testGetJsonConfig()
->with($priceInfoMock)
->willReturn(
[
'baseOldPrice' => [
'amount' => $amount,
],
'oldPrice' => [
'amount' => $amount,
],
Expand Down Expand Up @@ -386,6 +392,9 @@ private function getExpectedArray($productId, $amount, $priceQty, $percentage):
'currencyFormat' => '%s',
'optionPrices' => [
$productId => [
'baseOldPrice' => [
'amount' => $amount,
],
'oldPrice' => [
'amount' => $amount,
],
Expand All @@ -403,12 +412,15 @@ private function getExpectedArray($productId, $amount, $priceQty, $percentage):
],
],
'msrpPrice' => [
'amount' => null ,
'amount' => null,
]
],
],
'priceFormat' => [],
'prices' => [
'baseOldPrice' => [
'amount' => $amount,
],
'oldPrice' => [
'amount' => $amount,
],
Expand All @@ -434,7 +446,7 @@ private function getExpectedArray($productId, $amount, $priceQty, $percentage):
* @param MockObject $productMock
* @return MockObject
*/
private function getProductTypeMock(MockObject $productMock)
private function getProductTypeMock(MockObject $productMock): MockObject
{
$currencyMock = $this->getMockBuilder(Currency::class)
->disableOriginalConstructor()
Expand Down
Loading

0 comments on commit 5cd4345

Please sign in to comment.