Skip to content

Commit 2fc5ca5

Browse files
authored
Merge branch '2.4-develop' into improved-date-format-of-js-console-messages
2 parents fa6ae7e + 7377de5 commit 2fc5ca5

File tree

688 files changed

+28183
-3773
lines changed

Some content is hidden

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

688 files changed

+28183
-3773
lines changed

app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricingTest.php

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -333,9 +333,15 @@ public function testSaveAndReplaceAdvancedPricesAddRowErrorCall(): void
333333
'bunch'
334334
]
335335
];
336+
$count = 0;
336337
$this->dataSourceModel
337338
->method('getNextUniqueBunch')
338-
->willReturnOnConsecutiveCalls($testBunch);
339+
->willReturnCallback(function () use (&$count, $testBunch) {
340+
if ($count == 0) {
341+
$count++;
342+
return $testBunch;
343+
}
344+
});
339345
$this->advancedPricing->expects($this->once())->method('validateRow')->willReturn(false);
340346
$this->advancedPricing->method('saveProductPrices')->willReturnSelf();
341347

@@ -405,9 +411,15 @@ public function testSaveAndReplaceAdvancedPricesAppendBehaviourDataAndCalls(
405411
$advancedPricing
406412
->method('getBehavior')
407413
->willReturn(Import::BEHAVIOR_APPEND);
414+
$count = 0;
408415
$this->dataSourceModel
409416
->method('getNextUniqueBunch')
410-
->willReturnOnConsecutiveCalls($data);
417+
->willReturnCallback(function () use (&$count, $data) {
418+
if ($count == 0) {
419+
$count++;
420+
return $data;
421+
}
422+
});
411423
$advancedPricing->method('validateRow')->willReturn(true);
412424

413425
$advancedPricing->method('getCustomerGroupId')->willReturnMap(
@@ -529,9 +541,16 @@ public function testSaveAndReplaceAdvancedPricesReplaceBehaviourInternalCalls():
529541
$this->advancedPricing->method('getBehavior')->willReturn(
530542
Import::BEHAVIOR_REPLACE
531543
);
544+
545+
$count = 0;
532546
$this->dataSourceModel
533547
->method('getNextUniqueBunch')
534-
->willReturnOnConsecutiveCalls($data);
548+
->willReturnCallback(function () use (&$count, $data) {
549+
if ($count == 0) {
550+
$count++;
551+
return $data;
552+
}
553+
});
535554
$this->advancedPricing->expects($this->once())->method('validateRow')->willReturn(true);
536555

537556
$this->advancedPricing
@@ -582,9 +601,15 @@ public function testDeleteAdvancedPricingFormListSkuToDelete(): void
582601
]
583602
];
584603

604+
$count = 0;
585605
$this->dataSourceModel
586606
->method('getNextUniqueBunch')
587-
->willReturnOnConsecutiveCalls($data);
607+
->willReturnCallback(function () use (&$count, $data) {
608+
if ($count == 0) {
609+
$count++;
610+
return $data;
611+
}
612+
});
588613
$this->advancedPricing->method('validateRow')->willReturn(true);
589614
$expectedSkuList = ['sku value'];
590615
$this->advancedPricing

app/code/Magento/Authorization/Test/Fixture/Role.php

Lines changed: 57 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Magento\Authorization\Model\RulesFactory;
1414
use Magento\Authorization\Model\UserContextInterface;
1515
use Magento\Framework\DataObject;
16+
use Magento\TestFramework\Fixture\Api\DataMerger;
1617
use Magento\TestFramework\Fixture\Data\ProcessorInterface;
1718
use Magento\TestFramework\Fixture\RevertibleDataFixtureInterface;
1819

@@ -25,13 +26,16 @@ class Role implements RevertibleDataFixtureInterface
2526
'role_name' => 'Role Name %uniqid%',
2627
'role_type' => Group::ROLE_TYPE,
2728
'user_id' => 0,
28-
'user_type' => UserContextInterface::USER_TYPE_ADMIN
29+
'user_type' => UserContextInterface::USER_TYPE_ADMIN,
30+
'pid' => 0,
31+
'gws_is_all' => 1,
32+
'gws_websites' => null,
33+
'gws_store_groups' => null,
34+
'resources' => self::RESOURCES
2935
];
3036

31-
private const DEFAULT_DATA_RULES = [
32-
'id' => null,
33-
'role_id' => null,
34-
'resources' => ['Magento_Backend::all']
37+
private const RESOURCES = [
38+
'Magento_Backend::all'
3539
];
3640

3741
/**
@@ -54,39 +58,59 @@ class Role implements RevertibleDataFixtureInterface
5458
*/
5559
private $rulesFactory;
5660

61+
/**
62+
* @var DataMerger
63+
*/
64+
private $dataMerger;
65+
5766
/**
5867
* @param RoleFactory $roleFactory
5968
* @param RoleResource $roleResourceModel
6069
* @param RulesFactory $rulesFactory
6170
* @param ProcessorInterface $dataProcessor
71+
* @param DataMerger $dataMerger
6272
*/
6373
public function __construct(
6474
RoleFactory $roleFactory,
6575
RoleResource $roleResourceModel,
6676
RulesFactory $rulesFactory,
67-
ProcessorInterface $dataProcessor
77+
ProcessorInterface $dataProcessor,
78+
DataMerger $dataMerger
6879
) {
6980
$this->roleFactory = $roleFactory;
7081
$this->roleResourceModel = $roleResourceModel;
7182
$this->rulesFactory = $rulesFactory;
7283
$this->dataProcessor = $dataProcessor;
84+
$this->dataMerger = $dataMerger;
7385
}
7486

7587
/**
7688
* @inheritdoc
7789
*/
7890
public function apply(array $data = []): ?DataObject
7991
{
92+
$data = $this->prepareData($data);
93+
94+
$websites = $this->convertGwsWebsiteStoreGroups($data['gws_websites']);
95+
$storeGroups = $this->convertGwsWebsiteStoreGroups($data['gws_store_groups']);
96+
8097
$role = $this->roleFactory->create();
81-
$role->setData($this->prepareData(array_diff_key($data, self::DEFAULT_DATA_RULES)));
82-
$this->roleResourceModel->save($role);
98+
$role->setRoleName($data['role_name'])
99+
->setRoleType($data['role_type'])
100+
->setPid($data['pid'])
101+
->setUserType($data['user_type'])
102+
->setGwsIsAll($data['gws_is_all'])
103+
->setGwsWebsites($websites)
104+
->setGwsStoreGroups($storeGroups);
105+
106+
$result = $role->save();
83107

84-
$rules = $this->rulesFactory->create();
85-
$rules->setRoleId($role->getId() ?? null);
86-
$rules->setResources($data['resources'] ?? self::DEFAULT_DATA_RULES['resources']);
87-
$rules->saveRel();
108+
$this->rulesFactory->create()
109+
->setRoleId($result['role_id'])
110+
->setResources($data['resources'] ?? self::RESOURCES)
111+
->saveRel();
88112

89-
return $role;
113+
return $result;
90114
}
91115

92116
/**
@@ -110,7 +134,26 @@ public function revert(DataObject $data): void
110134
*/
111135
private function prepareData(array $data): array
112136
{
113-
$data = array_merge(self::DEFAULT_DATA, $data);
137+
$data = $this->dataMerger->merge(self::DEFAULT_DATA, $data);
114138
return $this->dataProcessor->process($this, $data);
115139
}
140+
141+
/**
142+
* Convert GWS websites and store groups to string
143+
*
144+
* @param $data
145+
* @return string|null
146+
*/
147+
private function convertGwsWebsiteStoreGroups($data): ?string
148+
{
149+
if (isset($data)) {
150+
if (is_array($data)) {
151+
return implode(',', $data);
152+
}
153+
if (is_string($data)) {
154+
return $data;
155+
}
156+
}
157+
return null;
158+
}
116159
}

app/code/Magento/AwsS3/Test/Unit/Driver/AwsS3Test.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,8 +439,8 @@ public function testSearchDirectory(): void
439439
$this->metadataProviderMock->expects(self::any())->method('getMetadata')
440440
->willReturnMap([
441441
['path', ['type' => AwsS3::TYPE_DIR]],
442-
['path/1', ['type' => AwsS3::TYPE_FILE]],
443-
['path/2', ['type' => AwsS3::TYPE_FILE]],
442+
['path/1', ['type' => AwsS3::TYPE_DIR]],
443+
['path/2', ['type' => AwsS3::TYPE_DIR]],
444444
]);
445445
$this->adapterMock->expects(self::atLeastOnce())->method('listContents')
446446
->willReturn(new \ArrayIterator($subPaths));

app/code/Magento/Backend/Test/Mftf/Section/AdminMessagesSection.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,7 @@
2323
<element name="errorMessage" type="text" selector=".message.message-error.error"/>
2424
<element name="warningMessage" type="text" selector=".message-warning"/>
2525
<element name="noticeMessage" type="text" selector=".message-notice"/>
26+
<element name="assertCacheManagementConfigurationStatus" type="button" selector="//td[@data-column='tags' and contains(text(),'CONFIG')]/following-sibling::td//span[@class='grid-severity-notice']//span"/>
27+
<element name="assertCacheManagementLayoutsStatus" type="button" selector="//td[@data-column='tags' and contains(text(),'LAYOUT_GENERAL_CACHE_TAG')]/following-sibling::td//span[@class='grid-severity-notice']//span"/>
2628
</section>
2729
</sections>
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/************************************************************************
4+
*
5+
* Copyright 2024 Adobe
6+
* All Rights Reserved.
7+
*
8+
* ************************************************************************
9+
*/
10+
-->
11+
12+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
13+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
14+
<test name="AdminOrderCreateAfterHtmlMinificationTest">
15+
<annotations>
16+
<features value="Backend"/>
17+
<stories value="Admin Panel with HTML minification"/>
18+
<title value="Admin panel should allow order creation with HTML minification enabled"/>
19+
<description value="Admin panel should allow order creation with HTML minification enabled"/>
20+
<testCaseId value="AC-12329"/>
21+
<useCaseId value="ACP2E-3169"/>
22+
<severity value="MAJOR"/>
23+
<group value="backend"/>
24+
<group value="cloud"/>
25+
</annotations>
26+
<before>
27+
<magentoCLI command="config:set {{MinifyHtmlFilesEnableConfigData.path}} {{MinifyHtmlFilesEnableConfigData.value}}" stepKey="enableHtmlMinification"/>
28+
<actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanCache">
29+
<argument name="tags" value="config"/>
30+
</actionGroup>
31+
<magentoCLI command="setup:static-content:deploy -f" stepKey="deployStaticContent"/>
32+
<createData entity="Simple_US_Customer_CA" stepKey="createSimpleCustomer"/>
33+
<createData entity="ApiProductWithDescription" stepKey="createSimpleProduct"/>
34+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
35+
</before>
36+
<after>
37+
<magentoCLI command="config:set {{MinifyHtmlFilesDisableConfigData.path}} {{MinifyHtmlFilesDisableConfigData.value}}" stepKey="disableHtmlMinification"/>
38+
<actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanCache">
39+
<argument name="tags" value="config"/>
40+
</actionGroup>
41+
<magentoCLI command="setup:static-content:deploy -f" stepKey="deployStaticContent"/>
42+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
43+
<deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/>
44+
<deleteData createDataKey="createSimpleCustomer" stepKey="deleteSimpleCustomer"/>
45+
</after>
46+
<waitForPageLoad stepKey="waitForPageLoadOnDashboard"/>
47+
<actionGroup ref="AssertAdminPageTitleActionGroup" stepKey="seeDashboardTitle">
48+
<argument name="value" value="Dashboard"/>
49+
</actionGroup>
50+
<actionGroup ref="CreateOrderActionGroup" stepKey="createOrder">
51+
<argument name="product" value="$$createSimpleProduct$$"/>
52+
<argument name="customer" value="$$createSimpleCustomer$$"/>
53+
</actionGroup>
54+
</test>
55+
</tests>

app/code/Magento/Backend/view/adminhtml/layout/default.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,11 @@
1111
<meta name="viewport" content="width=1024"/>
1212
<meta name="format-detection" content="telephone=no"/>
1313
<link src="requirejs/require.js"/>
14-
<css src="extjs/resources/css/ext-all.css"/>
15-
<css src="extjs/resources/css/ytheme-magento.css"/>
1614
</head>
1715
<body>
1816
<attribute name="id" value="html-body"/>
1917
<block name="require.js" class="Magento\Backend\Block\Page\RequireJs" template="Magento_Backend::page/js/require_js.phtml"/>
18+
<block class="Magento\Framework\View\Element\Template" name="head.critical" as="head.critical" template="Magento_Backend::page/container.phtml"/>
2019
<block class="Magento\Framework\View\Element\Template" name="head.additional" template="Magento_Backend::page/container.phtml"/>
2120
<referenceContainer name="global.notices">
2221
<block class="Magento\Backend\Block\Page\Notices" name="global_notices" as="global_notices" template="Magento_Backend::page/notices.phtml"/>

app/code/Magento/Backend/view/adminhtml/web/js/media-uploader.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ define([
7575
byteConvert(currentFile.size);
7676

7777
// check if file is allowed to upload and resize
78-
allowedResize = $.inArray(currentFile.extension, allowedExt) !== -1;
78+
allowedResize = $.inArray(currentFile.extension?.toLowerCase(), allowedExt) !== -1;
7979

8080
if (!allowedResize) {
8181
fileUploader.aggregateError(currentFile.name,

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@
1818
<testCaseId value="MC-115"/>
1919
<group value="Bundle"/>
2020
<group value="cloud"/>
21-
<skip>
22-
<issueId value="AC-12124">Fotorama lib isn't loaded</issueId>
23-
</skip>
21+
<!-- Excluded from PR builds due to AC-12124 -->
22+
<group value="pr_exclude"/>
2423
</annotations>
2524
<before>
2625
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
<group value="Bundle"/>
2020
<group value="pr_exclude"/>
2121
<group value="cloud"/>
22+
<skip>
23+
<issueId value="AC-10826"/>
24+
</skip>
2225
</annotations>
2326
<before>
2427
<createData entity="ApiProductWithDescription" stepKey="simpleProduct1" before="bundleProduct"/>

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

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,9 +1179,11 @@ function ($key) use ($optionCollection, $selectionCollection) {
11791179

11801180
$this->arrayUtility->expects($this->once())->method('flatten')->willReturn($bundleOptions);
11811181

1182-
$selectionCollection
1183-
->method('getItems')
1184-
->willReturnOnConsecutiveCalls([$selection], []);
1182+
$callCount = 0;
1183+
$selectionCollection->method('getItems')
1184+
->willReturnCallback(function () use (&$callCount, $selection) {
1185+
return $callCount++ === 0 ? [$selection] : [];
1186+
});
11851187
$selectionCollection
11861188
->method('getSize')
11871189
->willReturnOnConsecutiveCalls(1, 0);
@@ -1362,6 +1364,7 @@ public function testPrepareForCartAdvancedParentClassReturnString(): void
13621364

13631365
/**
13641366
* @return void
1367+
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
13651368
*/
13661369
public function testPrepareForCartAdvancedAllRequiredOption(): void
13671370
{
@@ -1452,12 +1455,14 @@ function ($key) use ($optionCollection) {
14521455
$buyRequest->expects($this->once())
14531456
->method('getBundleOption')
14541457
->willReturn([3 => 5]);
1458+
$callCount = 0;
14551459
$option->method('getId')
1456-
->willReturnOnConsecutiveCalls(3);
1460+
->willReturnCallback(function () use (&$callCount) {
1461+
return $callCount++ === 0 ? 3 : '';
1462+
});
14571463
$option->expects($this->once())
14581464
->method('getRequired')
14591465
->willReturn(true);
1460-
14611466
$result = $this->model->prepareForCartAdvanced($buyRequest, $product);
14621467
$this->assertEquals('Please select all required options.', $result);
14631468
}
@@ -1630,9 +1635,11 @@ public function testGetSkuWithoutType(): void
16301635
$selectionMock->expects(($this->any()))
16311636
->method('getItemByColumnValue')
16321637
->willReturn($selectionItemMock);
1633-
$selectionItemMock
1634-
->method('getEntityId')
1635-
->willReturnOnConsecutiveCalls(1);
1638+
$callCount = 0;
1639+
$selectionItemMock->method('getEntityId')
1640+
->willReturnCallback(function () use (&$callCount) {
1641+
return $callCount++ === 0 ? 1 : '';
1642+
});
16361643
$selectionItemMock->expects($this->once())
16371644
->method('getSku')
16381645
->willReturn($itemSku);

0 commit comments

Comments
 (0)