Skip to content

Commit d2bfc53

Browse files
committed
Merge branch '2.4-develop' of github.com:magento/magento2ce into eav-graphql
2 parents 047257a + 9d751c5 commit d2bfc53

File tree

95 files changed

+2494
-351
lines changed

Some content is hidden

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

95 files changed

+2494
-351
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@
8686

8787
<actionGroup ref="StorefrontCartPageOpenActionGroup" stepKey="goToCart"/>
8888

89-
<see selector="{{StorefrontBundledSection.nthItemOptionsValue('1')}}" userInput="1 x $$SimpleProduct1.name$$ $10.00" stepKey="seeOptionValue1"/>
90-
<see selector="{{StorefrontBundledSection.nthItemOptionsValue('2')}}" userInput="1 x $$SimpleProduct2.name$$ $15.00" stepKey="seeOptionValue2"/>
89+
<waitForText selector="{{StorefrontBundledSection.nthItemOptionsValue('1')}}" userInput="1 x $$SimpleProduct1.name$$ $10.00" stepKey="seeOptionValue1"/>
90+
<waitForText selector="{{StorefrontBundledSection.nthItemOptionsValue('2')}}" userInput="1 x $$SimpleProduct2.name$$ $15.00" stepKey="seeOptionValue2"/>
9191

9292
<openNewTab stepKey="openNewTab"/>
9393

@@ -115,12 +115,12 @@
115115
</actionGroup>
116116

117117
<click stepKey="clickEdit" selector="{{CheckoutCartProductSection.nthEditButton('1')}}"/>
118-
118+
<waitForElementClickable selector="{{StorefrontProductInfoMainSection.updateCart}}" stepKey="waitForUpdateCartButtonClickable" />
119119
<click selector="{{StorefrontProductInfoMainSection.updateCart}}" stepKey="clickUpdateCartButton"/>
120-
120+
<waitForElementClickable selector="{{CheckoutCartSummarySection.proceedToCheckout}}" stepKey="waitForProceedToCheckoutClickable" />
121121
<click selector="{{CheckoutCartSummarySection.proceedToCheckout}}" stepKey="clickProceedToCheckout"/>
122122

123-
<see selector="{{CheckoutHeaderSection.shippingMethodStep}}" userInput="Shipping" stepKey="checkShippingHeader"/>
123+
<waitForText selector="{{CheckoutHeaderSection.shippingMethodStep}}" userInput="Shipping" stepKey="checkShippingHeader"/>
124124

125125
</test>
126126
</tests>

app/code/Magento/Bundle/view/base/templates/product/price/final_price.phtml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
?>
77

88
<?php
9+
// @codingStandardsIgnoreFile
910
$idSuffix = $block->getIdSuffix() ? $block->getIdSuffix() : '';
1011
/** @var \Magento\Bundle\Pricing\Render\FinalPriceBox $block */
1112

@@ -22,7 +23,7 @@ $regularPriceAttributes = [
2223
'display_label' => __('Regular Price'),
2324
'price_id' => $block->getPriceId('old-price-' . $idSuffix),
2425
'include_container' => true,
25-
'skip_adjustments' => true
26+
'skip_adjustments' => false
2627
];
2728
$renderMinimalRegularPrice = $block->renderAmount($minimalRegularPrice, $regularPriceAttributes);
2829
?>

app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/type/bundle/option/radio.phtml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
* See COPYING.txt for license details.
55
*/
66
use Magento\Bundle\ViewModel\ValidateQuantity;
7+
8+
// phpcs:disable Generic.Files.LineLength.TooLong
79
?>
810
<?php /* @var $block \Magento\Bundle\Block\Catalog\Product\View\Type\Bundle\Option\Radio */ ?>
911
<?php $_option = $block->getOption(); ?>
@@ -49,8 +51,7 @@ $viewModel = $block->getData('validateQuantityViewModel');
4951
<div class="field choice">
5052
<input type="radio"
5153
class="radio product bundle option change-container-classname"
52-
id="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>
53-
-<?= $block->escapeHtmlAttr($_selection->getSelectionId()) ?>"
54+
id="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-<?= $block->escapeHtmlAttr($_selection->getSelectionId()) ?>"
5455
<?php if ($_option->getRequired()) {
5556
echo 'data-validate="{\'validate-one-required-by-name\':true}"';
5657
} ?>
@@ -61,8 +62,7 @@ $viewModel = $block->getData('validateQuantityViewModel');
6162
value="<?= $block->escapeHtmlAttr($_selection->getSelectionId()) ?>"
6263
data-errors-message-box="#validation-message-box-radio"/>
6364
<label class="label"
64-
for="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>
65-
-<?= $block->escapeHtmlAttr($_selection->getSelectionId()) ?>">
65+
for="bundle-option-<?= $block->escapeHtmlAttr($_option->getId()) ?>-<?= $block->escapeHtmlAttr($_selection->getSelectionId()) ?>">
6666
<span><?= /* @noEscape */ $block->getSelectionTitlePrice($_selection) ?></span>
6767
<br/>
6868
<?= /* @noEscape */ $block->getTierPriceRenderer()->renderTierPrice($_selection) ?>

app/code/Magento/Catalog/Pricing/Price/MinimalTierPriceCalculator.php

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
namespace Magento\Catalog\Pricing\Price;
88

9-
use Magento\Framework\Pricing\SaleableInterface;
109
use Magento\Framework\Pricing\Adjustment\CalculatorInterface;
1110
use Magento\Framework\Pricing\Amount\AmountInterface;
11+
use Magento\Framework\Pricing\SaleableInterface;
1212

1313
/**
1414
* As Low As shows minimal value of Tier Prices
@@ -36,18 +36,7 @@ public function __construct(CalculatorInterface $calculator)
3636
*/
3737
public function getValue(SaleableInterface $saleableItem)
3838
{
39-
/** @var TierPrice $price */
40-
$price = $saleableItem->getPriceInfo()->getPrice(TierPrice::PRICE_CODE);
41-
$tierPriceList = $price->getTierPriceList();
42-
43-
$tierPrices = [];
44-
foreach ($tierPriceList as $tierPrice) {
45-
/** @var AmountInterface $price */
46-
$price = $tierPrice['price'];
47-
$tierPrices[] = $price->getValue();
48-
}
49-
50-
return $tierPrices ? min($tierPrices) : null;
39+
return $this->getAmount($saleableItem)?->getValue();
5140
}
5241

5342
/**
@@ -58,10 +47,16 @@ public function getValue(SaleableInterface $saleableItem)
5847
*/
5948
public function getAmount(SaleableInterface $saleableItem)
6049
{
61-
$value = $this->getValue($saleableItem);
50+
$minPrice = null;
51+
/** @var TierPrice $price */
52+
$tierPrice = $saleableItem->getPriceInfo()->getPrice(TierPrice::PRICE_CODE);
53+
$tierPriceList = $tierPrice->getTierPriceList();
54+
55+
if (count($tierPriceList)) {
56+
usort($tierPriceList, fn ($tier1, $tier2) => $tier1['price']->getValue() <=> $tier2['price']->getValue());
57+
$minPrice = array_shift($tierPriceList)['price'];
58+
}
6259

63-
return $value === null
64-
? null
65-
: $this->calculator->getAmount($value, $saleableItem, 'tax');
60+
return $minPrice;
6661
}
6762
}

app/code/Magento/Catalog/Pricing/Render/FinalPriceBox.php

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,17 @@
66

77
namespace Magento\Catalog\Pricing\Render;
88

9-
use Magento\Catalog\Pricing\Price;
10-
use Magento\Framework\Pricing\Render\PriceBox as BasePriceBox;
11-
use Magento\Msrp\Pricing\Price\MsrpPrice;
129
use Magento\Catalog\Model\Product\Pricing\Renderer\SalableResolverInterface;
13-
use Magento\Framework\View\Element\Template\Context;
14-
use Magento\Framework\Pricing\SaleableInterface;
10+
use Magento\Catalog\Pricing\Price;
11+
use Magento\Catalog\Pricing\Price\MinimalPriceCalculatorInterface;
12+
use Magento\Framework\App\ObjectManager;
13+
use Magento\Framework\Pricing\Adjustment\CalculatorInterface;
1514
use Magento\Framework\Pricing\Price\PriceInterface;
15+
use Magento\Framework\Pricing\Render\PriceBox as BasePriceBox;
1616
use Magento\Framework\Pricing\Render\RendererPool;
17-
use Magento\Framework\App\ObjectManager;
18-
use Magento\Catalog\Pricing\Price\MinimalPriceCalculatorInterface;
17+
use Magento\Framework\Pricing\SaleableInterface;
18+
use Magento\Framework\View\Element\Template\Context;
19+
use Magento\Msrp\Pricing\Price\MsrpPrice;
1920

2021
/**
2122
* Class for final_price rendering
@@ -140,7 +141,7 @@ public function renderAmountMinimal()
140141
'display_label' => __('As low as'),
141142
'price_id' => $id,
142143
'include_container' => false,
143-
'skip_adjustments' => true
144+
'skip_adjustments' => false
144145
]
145146
);
146147
}
@@ -183,7 +184,7 @@ public function showMinimalPrice()
183184
public function getCacheKey()
184185
{
185186
return parent::getCacheKey()
186-
. ($this->getData('list_category_page') ? '-list-category-page': '')
187+
. ($this->getData('list_category_page') ? '-list-category-page' : '')
187188
. ($this->getSaleableItem()->getCustomerGroupId() ?? '');
188189
}
189190

app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductWithoutManageStockTest.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
</before>
2525
<after>
2626
<deleteData stepKey="deleteSimpleSubCategory" createDataKey="categoryEntity"/>
27+
<actionGroup ref="AdminProductCatalogPageOpenActionGroup" stepKey="openProductGridPage" />
28+
<actionGroup ref="AdminDeleteAllProductsFromGridActionGroup" stepKey="deleteProducts" />
2729
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
2830
</after>
2931

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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="StorefrontProductImageSlideTest">
12+
<annotations>
13+
<features value="Catalog"/>
14+
<stories value="Product Image"/>
15+
<title value="Product image should be visible and slide left or right on frontend in mobile"/>
16+
<description value="Product image should be visible and slide left or right on frontend in mobile"/>
17+
<group value="Catalog"/>
18+
<severity value="AVERAGE"/>
19+
<testCaseId value="AC-8441"/>
20+
</annotations>
21+
<before>
22+
<resizeWindow width="800" height="700" stepKey="resizeWindowToMobileView"/>
23+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
24+
</before>
25+
<after>
26+
<resizeWindow width="1280" height="1024" stepKey="resizeWindowToDesktop"/>
27+
<actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteProduct">
28+
<argument name="sku" value="{{SimpleProduct.sku}}"/>
29+
</actionGroup>
30+
<actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearFilter"/>
31+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutAsAdmin"/>
32+
</after>
33+
34+
<!--Create product-->
35+
<actionGroup ref="AdminOpenNewProductFormPageActionGroup" stepKey="openNewProductPage"/>
36+
<actionGroup ref="FillMainProductFormActionGroup" stepKey="fillSimpleProductMain">
37+
<argument name="product" value="SimpleProduct"/>
38+
</actionGroup>
39+
40+
<!-- Add image to product -->
41+
<actionGroup ref="AddProductImageActionGroup" stepKey="addImageForSimpleProduct">
42+
<argument name="image" value="TestImageWithDotInFilename"/>
43+
</actionGroup>
44+
<actionGroup ref="AddProductImageActionGroup" stepKey="addImageForSimpleProduct2">
45+
<argument name="image" value="TestImageWithDotInFilename"/>
46+
</actionGroup>
47+
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveSimpleProduct"/>
48+
49+
<!-- Assert product in storefront product page -->
50+
<actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageActionGroup" stepKey="assertProductInStorefrontProductPage">
51+
<argument name="product" value="SimpleProduct"/>
52+
</actionGroup>
53+
54+
<click selector="{{StorefrontProductMediaSection.fotoramaImageThumbnail('2')}}" stepKey="clickForFullScreenImage1"/>
55+
<wait stepKey="waitForImageScroll" time="2"/>
56+
<waitForElementVisible selector="{{StorefrontProductMediaSection.imagePrevButton}}" stepKey="waitPrevButton"/>
57+
<seeElement selector="{{StorefrontProductMediaSection.imagePrevButton}}" stepKey="seePrevButton"/>
58+
</test>
59+
</tests>

app/code/Magento/Catalog/Test/Unit/Pricing/Price/MinimalTierPriceCalculatorTest.php

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
namespace Magento\Catalog\Test\Unit\Pricing\Price;
99

10+
use Magento\Catalog\Pricing\Price\FinalPrice;
1011
use Magento\Catalog\Pricing\Price\MinimalTierPriceCalculator;
1112
use Magento\Catalog\Pricing\Price\TierPrice;
1213
use Magento\Framework\Pricing\Adjustment\CalculatorInterface;
@@ -73,10 +74,10 @@ private function getValueTierPricesExistShouldReturnMinTierPrice()
7374
$notMinPrice = 10;
7475

7576
$minAmount = $this->getMockForAbstractClass(AmountInterface::class);
76-
$minAmount->expects($this->once())->method('getValue')->willReturn($minPrice);
77+
$minAmount->expects($this->atLeastOnce())->method('getValue')->willReturn($minPrice);
7778

7879
$notMinAmount = $this->getMockForAbstractClass(AmountInterface::class);
79-
$notMinAmount->expects($this->once())->method('getValue')->willReturn($notMinPrice);
80+
$notMinAmount->expects($this->atLeastOnce())->method('getValue')->willReturn($notMinPrice);
8081

8182
$tierPriceList = [
8283
[
@@ -89,10 +90,12 @@ private function getValueTierPricesExistShouldReturnMinTierPrice()
8990

9091
$this->price->expects($this->once())->method('getTierPriceList')->willReturn($tierPriceList);
9192

92-
$this->priceInfo->expects($this->once())->method('getPrice')->with(TierPrice::PRICE_CODE)
93-
->willReturn($this->price);
93+
$this->priceInfo->expects($this->atLeastOnce())
94+
->method('getPrice')
95+
->withConsecutive([TierPrice::PRICE_CODE], [FinalPrice::PRICE_CODE])
96+
->willReturnOnConsecutiveCalls($this->price, $notMinAmount);
9497

95-
$this->saleable->expects($this->once())->method('getPriceInfo')->willReturn($this->priceInfo);
98+
$this->saleable->expects($this->atLeastOnce())->method('getPriceInfo')->willReturn($this->priceInfo);
9699
return $minPrice;
97100
}
98101

@@ -107,12 +110,8 @@ public function testGetGetAmountMinTierPriceExistShouldReturnAmountObject()
107110
$minPrice = $this->getValueTierPricesExistShouldReturnMinTierPrice();
108111

109112
$amount = $this->getMockForAbstractClass(AmountInterface::class);
113+
$amount->method('getValue')->willReturn($minPrice);
110114

111-
$this->calculator->expects($this->once())
112-
->method('getAmount')
113-
->with($minPrice, $this->saleable)
114-
->willReturn($amount);
115-
116-
$this->assertSame($amount, $this->object->getAmount($this->saleable));
115+
$this->assertEquals($amount, $this->object->getAmount($this->saleable));
117116
}
118117
}

app/code/Magento/Catalog/Test/Unit/Pricing/Render/FinalPriceBoxTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,10 +339,10 @@ public function testRenderAmountMinimal(): void
339339
$arguments = [
340340
'zone' => 'test_zone',
341341
'list_category_page' => true,
342-
'display_label' => 'As low as',
342+
'display_label' => __('As low as'),
343343
'price_id' => $priceId,
344344
'include_container' => false,
345-
'skip_adjustments' => true
345+
'skip_adjustments' => false
346346
];
347347

348348
$amountRender = $this->createPartialMock(Amount::class, ['toHtml']);

app/code/Magento/Catalog/view/base/templates/product/price/final_price.phtml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
?>
77

88
<?php
9+
// @codingStandardsIgnoreFile
910
/** @var \Magento\Catalog\Pricing\Render\FinalPriceBox $block */
1011

1112
/** ex: \Magento\Catalog\Pricing\Price\RegularPrice */
@@ -34,7 +35,7 @@ $schema = ($block->getZone() == 'item_view') ? true : false;
3435
'price_id' => $block->getPriceId('old-price-' . $idSuffix),
3536
'price_type' => 'oldPrice',
3637
'include_container' => true,
37-
'skip_adjustments' => true
38+
'skip_adjustments' => false
3839
]); ?>
3940
</span>
4041
<?php else :?>

0 commit comments

Comments
 (0)