Skip to content

Commit 73da277

Browse files
committed
Merge remote-tracking branch 'origin/2.4-develop' into 2.4-develop-pr83
2 parents d3347d0 + 1dc62a7 commit 73da277

File tree

25 files changed

+435
-60
lines changed

25 files changed

+435
-60
lines changed

app/code/Magento/Bundle/Model/Product/LinksList.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ public function __construct(
3939
}
4040

4141
/**
42+
* Bundle Product Items Data
43+
*
4244
* @param \Magento\Catalog\Api\Data\ProductInterface $product
4345
* @param int $optionId
4446
* @return \Magento\Bundle\Api\Data\LinkInterface[]
@@ -50,8 +52,12 @@ public function getItems(\Magento\Catalog\Api\Data\ProductInterface $product, $o
5052
$productLinks = [];
5153
/** @var \Magento\Catalog\Model\Product $selection */
5254
foreach ($selectionCollection as $selection) {
55+
$bundledProductPrice = $selection->getSelectionPriceValue();
56+
if ($bundledProductPrice <= 0) {
57+
$bundledProductPrice = $selection->getPrice();
58+
}
5359
$selectionPriceType = $product->getPriceType() ? $selection->getSelectionPriceType() : null;
54-
$selectionPrice = $product->getPriceType() ? $selection->getSelectionPriceValue() : null;
60+
$selectionPrice = $bundledProductPrice ? $bundledProductPrice : null;
5561

5662
/** @var \Magento\Bundle\Api\Data\LinkInterface $productLink */
5763
$productLink = $this->linkFactory->create();

app/code/Magento/Bundle/Test/Unit/Model/Product/LinksListTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function testLinksList()
9191
->method('getSelectionsCollection')
9292
->with([$optionId], $this->productMock)
9393
->willReturn([$this->selectionMock]);
94-
$this->productMock->expects($this->exactly(2))->method('getPriceType')->willReturn('price_type');
94+
$this->productMock->expects($this->once())->method('getPriceType')->willReturn('price_type');
9595
$this->selectionMock->expects($this->once())
9696
->method('getSelectionPriceType')
9797
->willReturn('selection_price_type');

app/code/Magento/Catalog/view/frontend/templates/product/list.phtml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ $_helper = $block->getData('outputHelper');
9898
<?= $block->getBlockHtml('formkey') ?>
9999
<button type="submit"
100100
title="<?= $escaper->escapeHtmlAttr(__('Add to Cart')) ?>"
101-
class="action tocart primary">
101+
class="action tocart primary"
102+
disabled>
102103
<span><?= $escaper->escapeHtml(__('Add to Cart')) ?></span>
103104
</button>
104105
</form>

app/code/Magento/Catalog/view/frontend/web/js/catalog-add-to-cart.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ define([
3434
if (this.options.bindSubmit) {
3535
this._bindSubmit();
3636
}
37+
$(this.options.addToCartButtonSelector).attr('disabled', false);
3738
},
3839

3940
/**

app/code/Magento/Contact/view/frontend/templates/form.phtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ $viewModel = $block->getViewModel();
6969
class="input-text"
7070
cols="5"
7171
rows="3"
72-
data-validate="{required:true}"><?= $block->escapeHtml($viewModel->getUserComment()) ?>
73-
</textarea>
72+
data-validate="{required:true}"
73+
><?= $block->escapeHtml($viewModel->getUserComment()) ?></textarea>
7474
</div>
7575
</div>
7676
<?= $block->getChildHtml('form.additional.info') ?>

app/code/Magento/CurrencySymbol/Block/Adminhtml/System/Currency.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,14 @@ protected function _prepareLayout()
4141
]
4242
);
4343

44-
$onClick = "setLocation('" . $this->getUrl('adminhtml/system_config/edit/section/currency') . "')";
44+
$currencyOptionPath = $this->getUrl(
45+
'adminhtml/system_config/edit',
46+
[
47+
'section' => 'currency',
48+
'_fragment' => 'currency_options-link'
49+
]
50+
);
51+
$onClick = "setLocation('$currencyOptionPath')";
4552

4653
$this->getToolbar()->addChild(
4754
'options_button',
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminNavigateToCurrencyRatesOptionActionGroup">
12+
<click selector="{{AdminCurrencyRatesSection.options}}" stepKey="clickOptionsButton"/>
13+
<waitForPageLoad stepKey="waitForPageLoad"/>
14+
</actionGroup>
15+
</actionGroups>

app/code/Magento/CurrencySymbol/Test/Mftf/Section/AdminCurrencyRatesSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<section name="AdminCurrencyRatesSection">
1212
<element name="import" type="button" selector="//button[@title='Import']"/>
1313
<element name="saveCurrencyRates" type="button" selector="//button[@title='Save Currency Rates']"/>
14+
<element name="options" type="button" selector="//button[@title='Options']"/>
1415
<element name="oldRate" type="text" selector="//div[contains(@class, 'admin__field-note') and contains(text(), 'Old rate:')]/strong"/>
1516
<element name="rateService" type="select" selector="#rate_services"/>
1617
<element name="currencyRate" type="input" selector="input[name='rate[{{fistCurrency}}][{{secondCurrency}}]']" parameterized="true"/>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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="AdminCurrencyOptionsSystemConfigExpandedTabTest">
12+
<annotations>
13+
<features value="Expanded tab on Currency Option page"/>
14+
<stories value="Expanded tab"/>
15+
<title value=" Verify the Currency Option tab expands automatically."/>
16+
<description value="Check auto open the collapse on Currency Option page."/>
17+
<severity value="MINOR"/>
18+
<testCaseId value="MC-37425"/>
19+
</annotations>
20+
<before>
21+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
22+
</before>
23+
<after>
24+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
25+
</after>
26+
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToStoresCurrencyRatesPage">
27+
<argument name="menuUiId" value="{{AdminMenuStores.dataUiId}}"/>
28+
<argument name="submenuUiId" value="{{AdminMenuStoresCurrencyCurrencyRates.dataUiId}}"/>
29+
</actionGroup>
30+
<actionGroup ref="AdminNavigateToCurrencyRatesOptionActionGroup" stepKey="navigateToOptions" />
31+
<grabAttributeFrom selector="{{CurrencySetupSection.currencyOptions}}" userInput="class" stepKey="grabClass"/>
32+
<assertStringContainsString stepKey="assertClass">
33+
<actualResult type="string">{$grabClass}</actualResult>
34+
<expectedResult type="string">open</expectedResult>
35+
</assertStringContainsString>
36+
</test>
37+
</tests>

app/code/Magento/CurrencySymbol/Test/Unit/Block/Adminhtml/System/CurrencyTest.php

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,22 @@
77

88
namespace Magento\CurrencySymbol\Test\Unit\Block\Adminhtml\System;
99

10+
use Magento\Backend\Block\Template\Context;
1011
use Magento\Backend\Block\Widget\Button;
1112
use Magento\CurrencySymbol\Block\Adminhtml\System\Currency;
1213
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
1314
use Magento\Framework\View\Element\BlockInterface;
1415
use Magento\Framework\View\LayoutInterface;
1516
use PHPUnit\Framework\TestCase;
17+
use Magento\Framework\UrlInterface;
1618

1719
class CurrencyTest extends TestCase
1820
{
21+
/**
22+
* Stub currency option link url
23+
*/
24+
const STUB_OPTION_LINK_URL = 'https://localhost/admin/system_config/edit/section/currency#currency_options-link';
25+
1926
/**
2027
* Object manager helper
2128
*
@@ -70,12 +77,25 @@ public function testPrepareLayout()
7077
]
7178
);
7279

80+
$contextMock = $this->createMock(Context::class);
81+
$urlBuilderMock = $this->createMock(UrlInterface::class);
82+
83+
$contextMock->expects($this->once())->method('getUrlBuilder')->willReturn($urlBuilderMock);
84+
85+
$urlBuilderMock->expects($this->once())->method('getUrl')->with(
86+
'adminhtml/system_config/edit',
87+
[
88+
'section' => 'currency',
89+
'_fragment' => 'currency_options-link'
90+
]
91+
)->willReturn(self::STUB_OPTION_LINK_URL);
92+
7393
$childBlockMock->expects($this->at(1))
7494
->method('addChild')
7595
->with(
7696
'options_button',
7797
Button::class,
78-
['label' => __('Options'), 'onclick' => 'setLocation(\'\')']
98+
['label' => __('Options'), 'onclick' => 'setLocation(\''.self::STUB_OPTION_LINK_URL.'\')']
7999
);
80100

81101
$childBlockMock->expects($this->at(2))
@@ -90,7 +110,8 @@ public function testPrepareLayout()
90110
$block = $this->objectManagerHelper->getObject(
91111
Currency::class,
92112
[
93-
'layout' => $layoutMock
113+
'layout' => $layoutMock,
114+
'context' => $contextMock
94115
]
95116
);
96117
$block->setLayout($layoutMock);

0 commit comments

Comments
 (0)