Skip to content

Commit d3de496

Browse files
Merge branch '2.4-develop' into AC-11660
2 parents 40e857c + de4dfb8 commit d3de496

File tree

91 files changed

+2187
-606
lines changed

Some content is hidden

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

91 files changed

+2187
-606
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
/**
3+
* Copyright 2024 Adobe
4+
* All Rights Reserved.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Backend\ViewModel;
9+
10+
/**
11+
* View model interface for requirejs configuration modifier
12+
*/
13+
interface RequireJsConfigModifierInterface
14+
{
15+
/**
16+
* Modifies requirejs configuration
17+
*
18+
* @param array $config requirejs configuration
19+
* @return array
20+
*/
21+
public function modify(array $config): array;
22+
}

app/code/Magento/Backend/view/adminhtml/templates/page/js/require_js.phtml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,20 @@
55
*/
66

77
/** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */
8+
/** @var \Magento\Backend\Block\Page\RequireJs $block */
9+
10+
$requireJsConfig = [
11+
'baseUrl' => $block->getViewFileUrl('/'),
12+
];
13+
14+
$configModifier = $block->getConfigModifier();
15+
$requireJsConfig = $configModifier instanceof \Magento\Backend\ViewModel\RequireJsConfigModifierInterface
16+
? $configModifier->modify($requireJsConfig)
17+
: $requireJsConfig;
818

919
$scriptString = '
1020
var BASE_URL = \'' . /* @noEscape */ $block->getUrl('*') . '\';
1121
var FORM_KEY = \'' . /* @noEscape */ $block->getFormKey() . '\';
12-
var require = {
13-
\'baseUrl\': \'' . /* @noEscape */ $block->getViewFileUrl('/') . '\'
14-
};';
15-
16-
echo /* @noEscape */ $secureRenderer->renderTag('script', [], $scriptString, false);
22+
var require = ' . /* @noEscape */ json_encode($requireJsConfig) .';';
23+
?>
24+
<?= /* @noEscape */ $secureRenderer->renderTag('script', [], $scriptString, false) ?>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/************************************************************************
4+
*
5+
* Copyright 2023 Adobe
6+
* All Rights Reserved.
7+
*
8+
* NOTICE: All information contained herein is, and remains
9+
* the property of Adobe and its suppliers, if any. The intellectual
10+
* and technical concepts contained herein are proprietary to Adobe
11+
* and its suppliers and are protected by all applicable intellectual
12+
* property laws, including trade secret and copyright laws.
13+
* Dissemination of this information or reproduction of this material
14+
* is strictly forbidden unless prior written permission is obtained
15+
* from Adobe.
16+
* ***********************************************************************
17+
*/
18+
-->
19+
20+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
21+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
22+
<actionGroup name="AdminFillCatalogProductsListWidgetSkuActionGroup">
23+
<annotations>
24+
<description>Fill catalog products list widget sku.</description>
25+
</annotations>
26+
27+
<arguments>
28+
<argument name="sku" type="string" defaultValue=""/>
29+
</arguments>
30+
31+
<waitForElementVisible selector="{{WidgetSection.AddParam}}" stepKey="waitForAddParamElement"/>
32+
<click selector="{{WidgetSection.AddParam}}" stepKey="clickOnAddParamElement"/>
33+
<waitForElementVisible selector="{{WidgetSection.ConditionsDropdown}}"
34+
stepKey="waitForConditionsDropdownVisible"/>
35+
<selectOption selector="{{WidgetSection.ConditionsDropdown}}" userInput="SKU" stepKey="selectSkuAsCondition"/>
36+
<waitForElementVisible selector="{{WidgetSection.RuleParam}}" stepKey="waitForRuleParamElementVisible"/>
37+
<click selector="{{WidgetSection.RuleParam}}" stepKey="clickToAddRuleParam"/>
38+
<fillField selector=".rule-param-edit input" userInput="{{sku}}" stepKey="fillSkuField"/>
39+
<click selector="{{AdminNewWidgetSection.applyParameter}}" stepKey="clickApplyButton"/>
40+
</actionGroup>
41+
</actionGroups>
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/************************************************************************
4+
*
5+
* Copyright 2023 Adobe
6+
* All Rights Reserved.
7+
*
8+
* NOTICE: All information contained herein is, and remains
9+
* the property of Adobe and its suppliers, if any. The intellectual
10+
* and technical concepts contained herein are proprietary to Adobe
11+
* and its suppliers and are protected by all applicable intellectual
12+
* property laws, including trade secret and copyright laws.
13+
* Dissemination of this information or reproduction of this material
14+
* is strictly forbidden unless prior written permission is obtained
15+
* from Adobe.
16+
* ***********************************************************************
17+
*/
18+
-->
19+
20+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
21+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
22+
<test name="StorefrontBundleAddToCartFromWidget">
23+
<annotations>
24+
<features value="Bundle"/>
25+
<stories value="Bundle product details page"/>
26+
<title value="Customer should be able to add a bundle product to the cart from widget"/>
27+
<description value="Customer should be able to add a bundle product to the cart from widget"/>
28+
<severity value="CRITICAL"/>
29+
<testCaseId value="AC-10867"/>
30+
<useCaseId value="ACP2E-2615"/>
31+
<group value="WYSIWYGDisabled"/>
32+
<group value="Bundle"/>
33+
</annotations>
34+
<before>
35+
<actionGroup ref="AdminLoginActionGroup" stepKey="login"/>
36+
<createData entity="SimpleProduct2" stepKey="simpleProduct1"/>
37+
</before>
38+
<after>
39+
<actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteBundleProductBySku">
40+
<argument name="sku" value="{{BundleProductWithSlashSku.sku}}"/>
41+
</actionGroup>
42+
<deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/>
43+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
44+
</after>
45+
46+
<!-- Start creating a bundle product -->
47+
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="goToProductList"/>
48+
<actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateProduct">
49+
<argument name="product" value="BundleProduct"/>
50+
</actionGroup>
51+
<actionGroup ref="FillProductNameAndSkuInProductFormActionGroup" stepKey="fillNameAndSku">
52+
<argument name="product" value="BundleProductWithSlashSku"/>
53+
</actionGroup>
54+
55+
<!-- Add Option One, a "Drop-down" type option -->
56+
<actionGroup ref="AddBundleOptionWithOneProductActionGroup" stepKey="addBundleOptionWithOneProduct">
57+
<argument name="x" value="0"/>
58+
<argument name="n" value="1"/>
59+
<argument name="prodOneSku" value="$$simpleProduct1.sku$$"/>
60+
<argument name="prodTwoSku" value=""/>
61+
<argument name="optionTitle" value="Option One"/>
62+
<argument name="inputType" value="select"/>
63+
</actionGroup>
64+
65+
<!-- Save product, edit Homepage CMS page and add products widget -->
66+
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/>
67+
<amOnPage url="{{AdminCmsPageEditPage.url(CmsHomePageContent.page_id)}}" stepKey="navigateToEditCmsHomePage"/>
68+
<click selector="{{CmsNewPagePageContentSection.header}}" stepKey="clickContentTab" />
69+
<actionGroup ref="AdminInsertWidgetToCmsPageContentActionGroup" stepKey="insertWidgetToCmsPageContentActionGroup">
70+
<argument name="widgetType" value="Catalog Products List"/>
71+
</actionGroup>
72+
<actionGroup ref="AdminFillCatalogProductsListWidgetSkuActionGroup" stepKey="selectProductForListing">
73+
<argument name="sku" value="{{BundleProductWithSlashSku.sku}}"/>
74+
</actionGroup>
75+
<actionGroup ref="AdminClickInsertWidgetActionGroup" stepKey="clickInsertWidgetButton2"/>
76+
<actionGroup ref="SaveCmsPageActionGroup" stepKey="clickSaveButton"/>
77+
<see selector="{{AdminMessagesSection.success}}" userInput="You saved the page." stepKey="seeSuccess"/>
78+
79+
<!-- Go to storefront homepage and add to cart -->
80+
<actionGroup ref="StorefrontOpenHomePageActionGroup" stepKey="goToHomePage"/>
81+
<actionGroup ref="StorefrontHoverProductOnCategoryPageActionGroup" stepKey="hoverProduct"/>
82+
<actionGroup ref="StorefrontClickAddToCartButtonActionGroup" stepKey="addToCart"/>
83+
<waitForPageLoad stepKey="waitForProductAdded"/>
84+
<waitForElementVisible selector="{{StorefrontMessagesSection.success}}" stepKey="seeSuccessMessage"/>
85+
</test>
86+
</tests>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
<actionGroup ref="StorefrontOpenCheckoutPageActionGroup" stepKey="openCheckoutPage"/>
8080
<!--Click next button to open payment section-->
8181
<actionGroup ref="StorefrontCheckoutClickNextButtonActionGroup" stepKey="clickNext"/>
82+
<actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectDefaultPaymentMethod"/>
8283
<!--Click place order-->
8384
<actionGroup ref="ClickPlaceOrderActionGroup" stepKey="placeOrder"/>
8485
<actionGroup ref="StorefrontClickOrderLinkFromCheckoutSuccessPageActionGroup" stepKey="clickOrderLink"/>

app/code/Magento/Catalog/Controller/Product/Compare/Index.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
*/
77
namespace Magento\Catalog\Controller\Product\Compare;
88

9-
use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface;
109
use Magento\Catalog\Api\ProductRepositoryInterface;
10+
use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface;
1111
use Magento\Framework\Data\Form\FormKey\Validator;
1212
use Magento\Framework\View\Result\PageFactory;
1313

@@ -81,6 +81,8 @@ public function execute()
8181
$this->_catalogSession->setBeforeCompareUrl(
8282
$this->urlDecoder->decode($beforeUrl)
8383
);
84+
} else {
85+
$this->_catalogSession->unsBeforeCompareUrl();
8486
}
8587
return $this->resultPageFactory->create();
8688
}

app/code/Magento/Catalog/CustomerData/CompareProducts.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Magento\Framework\App\Config\ScopeConfigInterface;
1010
use Magento\Framework\App\ObjectManager;
1111
use Magento\Framework\Exception\LocalizedException;
12+
use Magento\Framework\UrlInterface;
1213
use Magento\Store\Model\StoreManagerInterface;
1314

1415
/**
@@ -43,25 +44,33 @@ class CompareProducts implements SectionSourceInterface
4344
*/
4445
private $storeManager;
4546

47+
/**
48+
* @var UrlInterface
49+
*/
50+
private $urlBuilder;
51+
4652
/**
4753
* @param \Magento\Catalog\Helper\Product\Compare $helper
4854
* @param \Magento\Catalog\Model\Product\Url $productUrl
4955
* @param \Magento\Catalog\Helper\Output $outputHelper
5056
* @param ScopeConfigInterface|null $scopeConfig
5157
* @param StoreManagerInterface|null $storeManager
58+
* @param UrlInterface|null $urlBuilder
5259
*/
5360
public function __construct(
5461
\Magento\Catalog\Helper\Product\Compare $helper,
5562
\Magento\Catalog\Model\Product\Url $productUrl,
5663
\Magento\Catalog\Helper\Output $outputHelper,
5764
?ScopeConfigInterface $scopeConfig = null,
58-
?StoreManagerInterface $storeManager = null
65+
?StoreManagerInterface $storeManager = null,
66+
?UrlInterface $urlBuilder = null
5967
) {
6068
$this->helper = $helper;
6169
$this->productUrl = $productUrl;
6270
$this->outputHelper = $outputHelper;
6371
$this->scopeConfig = $scopeConfig ?? ObjectManager::getInstance()->get(ScopeConfigInterface::class);
6472
$this->storeManager = $storeManager ?? ObjectManager::getInstance()->get(StoreManagerInterface::class);
73+
$this->urlBuilder = $urlBuilder ?? ObjectManager::getInstance()->get(UrlInterface::class);
6574
}
6675

6776
/**
@@ -73,7 +82,7 @@ public function getSectionData()
7382
return [
7483
'count' => $count,
7584
'countCaption' => $count == 1 ? __('1 item') : __('%1 items', $count),
76-
'listUrl' => $this->helper->getListUrl(),
85+
'listUrl' => $this->urlBuilder->getUrl('catalog/product_compare/index'),
7786
'items' => $count ? $this->getItems() : [],
7887
'websiteId' => $this->storeManager->getWebsite()->getId()
7988
];

app/code/Magento/Catalog/Test/Mftf/Data/ImageData.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,14 @@
7979
<data key="filename">png</data>
8080
<data key="file_extension">png</data>
8181
</entity>
82+
<entity name="placeholderDummyBaseImage" type="imageFile">
83+
<data key="file">Dummy(3).jpg</data>
84+
<data key="name">Dummy(3)</data>
85+
<data key="extension">jpg</data>
86+
</entity>
87+
<entity name="PageBuilderBackgroundImage_LargerThan2MB" type="imageFile">
88+
<data key="file">LargerThan2MB.jpg</data>
89+
<data key="name">LargerThan2MB</data>
90+
<data key="extension">jpg</data>
91+
</entity>
8292
</entities>

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
</annotations>
2020
<before>
2121
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
22+
<magentoCLI command="config:set cms/pagebuilder/enabled 0" stepKey="disablePageBuilder"/>
2223
<actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/>
2324
<actionGroup ref="CliEnableTinyMCEActionGroup" stepKey="enableTinyMCE" />
2425
<actionGroup ref="CliMediaGalleryEnhancedEnableActionGroup" stepKey="enableOldMediaGallery">
@@ -27,11 +28,12 @@
2728
</before>
2829
<after>
2930
<actionGroup ref="CliEnableTinyMCEActionGroup" stepKey="enableTinyMCE" />
30-
<actionGroup ref="AdminDisableWYSIWYGActionGroup" stepKey="disableWYSIWYG"/>
31+
<actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/>
3132
<actionGroup ref="CliMediaGalleryEnhancedEnableActionGroup" stepKey="enableOldMediaGallery">
3233
<argument name="enabled" value="0"/>
3334
</actionGroup>
3435
<actionGroup ref="AdminLogoutActionGroup" stepKey="amOnLogoutPage"/>
36+
<magentoCLI command="config:set cms/pagebuilder/enabled 1" stepKey="enablePageBuilder"/>
3537
</after>
3638

3739
<actionGroup ref="AdminOpenNewProductFormPageActionGroup" stepKey="navigateToNewProduct"/>

app/code/Magento/Catalog/Test/Unit/CustomerData/CompareProductsTest.php

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,15 @@
1717
use Magento\Catalog\Model\ResourceModel\Product\Compare\Item\Collection;
1818
use Magento\Framework\App\Config\ScopeConfigInterface;
1919
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
20+
use Magento\Framework\UrlInterface;
21+
use Magento\Store\Model\StoreManagerInterface;
2022
use Magento\Store\Model\Website;
2123
use PHPUnit\Framework\MockObject\MockObject;
2224
use PHPUnit\Framework\TestCase;
23-
use Magento\Store\Model\StoreManagerInterface;
2425

26+
/**
27+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
28+
*/
2529
class CompareProductsTest extends TestCase
2630
{
2731
/**
@@ -64,6 +68,11 @@ class CompareProductsTest extends TestCase
6468
*/
6569
private $websiteMock;
6670

71+
/**
72+
* @var UrlInterface|MockObject
73+
*/
74+
private $urlBuilder;
75+
6776
/**
6877
* @var array
6978
*/
@@ -88,6 +97,9 @@ protected function setUp(): void
8897
$this->scopeConfigMock = $this->getMockBuilder(ScopeConfigInterface::class)
8998
->disableOriginalConstructor()
9099
->getMockForAbstractClass();
100+
$this->urlBuilder = $this->getMockBuilder(UrlInterface::class)
101+
->disableOriginalConstructor()
102+
->getMock();
91103

92104
$this->storeManagerMock = $this->getMockBuilder(
93105
StoreManagerInterface::class
@@ -97,7 +109,7 @@ protected function setUp(): void
97109
$this->websiteMock = $this->getMockBuilder(
98110
Website::class
99111
)->onlyMethods(
100-
['getId',]
112+
['getId']
101113
)->disableOriginalConstructor()
102114
->getMock();
103115

@@ -110,8 +122,8 @@ protected function setUp(): void
110122
'productUrl' => $this->productUrlMock,
111123
'outputHelper' => $this->outputHelperMock,
112124
'scopeConfig' => $this->scopeConfigMock,
113-
'storeManager' => $this->storeManagerMock
114-
125+
'storeManager' => $this->storeManagerMock,
126+
'urlBuilder' => $this->urlBuilder
115127
]
116128
);
117129
}
@@ -219,9 +231,10 @@ public function testGetSectionData()
219231
->method('getItemCollection')
220232
->willReturn($itemCollectionMock);
221233

222-
$this->helperMock->expects($this->once())
223-
->method('getListUrl')
234+
$this->urlBuilder->expects($this->once())
235+
->method('getUrl')
224236
->willReturn('http://list.url');
237+
225238
$this->storeManagerMock->expects($this->any())->method('getWebsite')->willReturn($this->websiteMock);
226239
$this->websiteMock->expects($this->any())->method('getId')->willReturn(1);
227240
$this->assertEquals(
@@ -269,8 +282,8 @@ public function testGetSectionDataNoItems()
269282
$this->helperMock->expects($this->never())
270283
->method('getItemCollection');
271284

272-
$this->helperMock->expects($this->once())
273-
->method('getListUrl')
285+
$this->urlBuilder->expects($this->once())
286+
->method('getUrl')
274287
->willReturn('http://list.url');
275288

276289
$this->storeManagerMock->expects($this->any())->method('getWebsite')->willReturn($this->websiteMock);
@@ -314,8 +327,8 @@ public function testGetSectionDataSingleItem()
314327
->method('getItemCollection')
315328
->willReturn($itemCollectionMock);
316329

317-
$this->helperMock->expects($this->once())
318-
->method('getListUrl')
330+
$this->urlBuilder->expects($this->once())
331+
->method('getUrl')
319332
->willReturn('http://list.url');
320333

321334
$this->assertEquals(

0 commit comments

Comments
 (0)