Skip to content

Commit ad4cd7a

Browse files
committed
Merge remote-tracking branch 'mainline/2.4-develop' into ACP2E-2101
2 parents 2121aa3 + 2932016 commit ad4cd7a

File tree

1,969 files changed

+65127
-67361
lines changed

Some content is hidden

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

1,969 files changed

+65127
-67361
lines changed

app/code/Magento/AsyncConfig/Test/Mftf/Test/AsyncConfigurationTest.xml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,18 @@
2121
<before>
2222
<!--Enable Async Configuration-->
2323
<magentoCLI stepKey="EnableAsyncConfig" command="setup:config:set --no-interaction --config-async 1"/>
24-
<magentoCLI stepKey="ClearConfigCache" command="cache:flush"/>
24+
<actionGroup ref="CliCacheFlushActionGroup" stepKey="ClearConfigCache">
25+
<argument name="tags" value=""/>
26+
</actionGroup>
2527
<!--Login to Admin-->
2628
<actionGroup ref="AdminLoginActionGroup" stepKey="LoginAsAdmin"/>
2729
</before>
2830
<after>
2931
<magentoCLI stepKey="DisableAsyncConfig" command="setup:config:set --no-interaction --config-async 0"/>
3032
<magentoCLI stepKey="setBackDefaultConfigValue" command="config:set catalog/frontend/grid_per_page 12" />
31-
<magentoCLI stepKey="ClearConfigCache" command="cache:clean"/>
33+
<actionGroup ref="CliCacheCleanActionGroup" stepKey="ClearConfigCache">
34+
<argument name="tags" value="config"/>
35+
</actionGroup>
3236
<actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/>
3337
</after>
3438

app/code/Magento/AsynchronousOperations/Model/ResourceModel/System/Message/Collection/Synchronized/Plugin.php

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
*/
1111
class Plugin
1212
{
13+
private const MESSAGES_LIMIT = 5;
1314
/**
1415
* @var \Magento\AdminNotification\Model\System\MessageFactory
1516
*/
@@ -95,27 +96,32 @@ public function afterToArray(
9596
$this->bulkNotificationManagement->getAcknowledgedBulksByUser($userId)
9697
);
9798
$bulkMessages = [];
99+
$messagesCount = 0;
100+
$data = [];
98101
foreach ($userBulks as $bulk) {
99102
$bulkUuid = $bulk->getBulkId();
100103
if (!in_array($bulkUuid, $acknowledgedBulks)) {
101-
$details = $this->operationDetails->getDetails($bulkUuid);
102-
$text = $this->getText($details);
103-
$bulkStatus = $this->statusMapper->operationStatusToBulkSummaryStatus($bulk->getStatus());
104-
if ($bulkStatus === \Magento\Framework\Bulk\BulkSummaryInterface::IN_PROGRESS) {
105-
$text = __('%1 item(s) are currently being updated.', $details['operations_total']) . $text;
104+
if ($messagesCount < self::MESSAGES_LIMIT) {
105+
$details = $this->operationDetails->getDetails($bulkUuid);
106+
$text = $this->getText($details);
107+
$bulkStatus = $this->statusMapper->operationStatusToBulkSummaryStatus($bulk->getStatus());
108+
if ($bulkStatus === \Magento\Framework\Bulk\BulkSummaryInterface::IN_PROGRESS) {
109+
$text = __('%1 item(s) are currently being updated.', $details['operations_total']) . $text;
110+
}
111+
$data = [
112+
'data' => [
113+
'text' => __('Task "%1": ', $bulk->getDescription()) . $text,
114+
'severity' => \Magento\Framework\Notification\MessageInterface::SEVERITY_MAJOR,
115+
// md5() here is not for cryptographic use.
116+
// phpcs:ignore Magento2.Security.InsecureFunction
117+
'identity' => md5('bulk' . $bulkUuid),
118+
'uuid' => $bulkUuid,
119+
'status' => $bulkStatus,
120+
'created_at' => $bulk->getStartTime()
121+
]
122+
];
123+
$messagesCount++;
106124
}
107-
$data = [
108-
'data' => [
109-
'text' => __('Task "%1": ', $bulk->getDescription()) . $text,
110-
'severity' => \Magento\Framework\Notification\MessageInterface::SEVERITY_MAJOR,
111-
// md5() here is not for cryptographic use.
112-
// phpcs:ignore Magento2.Security.InsecureFunction
113-
'identity' => md5('bulk' . $bulkUuid),
114-
'uuid' => $bulkUuid,
115-
'status' => $bulkStatus,
116-
'created_at' => $bulk->getStartTime()
117-
]
118-
];
119125
$bulkMessages[] = $this->messageFactory->create($data)->toArray();
120126
}
121127
}

app/code/Magento/AsynchronousOperations/Test/Unit/Model/ResourceModel/System/Message/Collection/Synchronized/PluginTest.php

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
*/
2828
class PluginTest extends TestCase
2929
{
30+
private const MESSAGES_LIMIT = 5;
3031
/**
3132
* @var Plugin
3233
*/
@@ -163,6 +164,60 @@ public function testAfterTo($operationDetails)
163164
$this->assertEquals(2, $result2['totalRecords']);
164165
}
165166

167+
/**
168+
* Tests that message building operations don't get called more than Plugin::MESSAGES_LIMIT times
169+
*
170+
* @return void
171+
*/
172+
public function testAfterToWithMessageLimit()
173+
{
174+
$result = ['items' =>[], 'totalRecords' => 1];
175+
$messagesCount = self::MESSAGES_LIMIT + 1;
176+
$userId = 1;
177+
$bulkUuid = 2;
178+
$bulkArray = [
179+
'status' => BulkSummaryInterface::NOT_STARTED
180+
];
181+
182+
$bulkMock = $this->getMockBuilder(BulkSummary::class)
183+
->addMethods(['getStatus'])
184+
->onlyMethods(['getBulkId', 'getDescription', 'getStartTime'])
185+
->disableOriginalConstructor()
186+
->getMock();
187+
$userBulks = array_fill(0, $messagesCount, $bulkMock);
188+
$bulkMock->expects($this->exactly($messagesCount))
189+
->method('getBulkId')->willReturn($bulkUuid);
190+
$this->operationsDetailsMock
191+
->expects($this->exactly(self::MESSAGES_LIMIT))
192+
->method('getDetails')
193+
->with($bulkUuid)
194+
->willReturn([
195+
'operations_successful' => 1,
196+
'operations_failed' => 0
197+
]);
198+
$bulkMock->expects($this->exactly(self::MESSAGES_LIMIT))
199+
->method('getDescription')->willReturn('Bulk Description');
200+
$this->messagefactoryMock->expects($this->exactly($messagesCount))
201+
->method('create')->willReturn($this->messageMock);
202+
$this->messageMock->expects($this->exactly($messagesCount))->method('toArray')->willReturn($bulkArray);
203+
$this->authorizationMock
204+
->expects($this->once())
205+
->method('isAllowed')
206+
->with($this->resourceName)
207+
->willReturn(true);
208+
$this->userContextMock->expects($this->once())->method('getUserId')->willReturn($userId);
209+
$this->bulkNotificationMock
210+
->expects($this->once())
211+
->method('getAcknowledgedBulksByUser')
212+
->with($userId)
213+
->willReturn([]);
214+
$this->statusMapper->expects($this->exactly(self::MESSAGES_LIMIT))
215+
->method('operationStatusToBulkSummaryStatus');
216+
$this->bulkStatusMock->expects($this->once())->method('getBulksByUser')->willReturn($userBulks);
217+
$result2 = $this->plugin->afterToArray($this->collectionMock, $result);
218+
$this->assertEquals($result['totalRecords'] + $messagesCount, $result2['totalRecords']);
219+
}
220+
166221
/**
167222
* @return array
168223
*/

app/code/Magento/AwsS3/Driver/AwsS3.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -893,16 +893,24 @@ public function fileClose($resource): bool
893893
*/
894894
public function fileOpen($path, $mode)
895895
{
896+
$_mode = str_replace(['b', '+'], '', strtolower($mode));
897+
if (!in_array($_mode, ['r', 'w', 'a'], true)) {
898+
throw new FileSystemException(new Phrase('Invalid file open mode "%1".', [$mode]));
899+
}
896900
$path = $this->normalizeRelativePath($path, true);
897901

898902
if (!isset($this->streams[$path])) {
899903
$this->streams[$path] = tmpfile();
900904
try {
901905
if ($this->adapter->fileExists($path)) {
902-
//phpcs:ignore Magento2.Functions.DiscouragedFunction
903-
fwrite($this->streams[$path], $this->adapter->read($path));
904-
//phpcs:ignore Magento2.Functions.DiscouragedFunction
905-
rewind($this->streams[$path]);
906+
if ($_mode !== 'w') {
907+
//phpcs:ignore Magento2.Functions.DiscouragedFunction
908+
fwrite($this->streams[$path], $this->adapter->read($path));
909+
//phpcs:ignore Magento2.Functions.DiscouragedFunction
910+
if ($_mode !== 'a') {
911+
rewind($this->streams[$path]);
912+
}
913+
}
906914
}
907915
} catch (FlysystemFilesystemException $e) {
908916
$this->logger->error($e->getMessage());

app/code/Magento/AwsS3/Test/Mftf/Test/AwsS3AdminCreateDownloadableProductWithLinkTest.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
<comment userInput="BIC workaround" stepKey="disableRemoteStorage"/>
3636
<magentoCLI stepKey="removeDownloadableDomain" command="downloadable:domains:remove static.magento.com"/>
3737
<!-- Delete customer -->
38+
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="logoutCustomer" />
3839
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
3940

4041
<!-- Delete category -->
@@ -81,7 +82,9 @@
8182

8283
<!-- Save product -->
8384
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/>
84-
<magentoCron stepKey="runIndexCronJobs" groups="index"/>
85+
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="runIndexCronJobs">
86+
<argument name="indices" value=""/>
87+
</actionGroup>
8588

8689
<!-- Login to frontend -->
8790
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="signIn">
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
AdminExportTaxRatesTest
2+
ImportProduct_Bundle
3+
ImportProductSimple1_Bundle
4+
ImportProductSimple2_Bundle
5+
ImportProductSimple3_Bundle
6+
CliCacheFlushActionGroup
7+
AdminFillImportFormActionGroup
8+
ImportProduct_Downloadable_FileLinks
9+
ImportProduct_Downloadable_UrlLinks
10+
ImportProduct_Grouped
11+
ImportProductSimple1_Grouped
12+
ImportProductSimple2_Grouped
13+
ImportProductSimple3_Grouped
14+
ImportProduct_Configurable
15+
ImportProductSimple1_Configurable
16+
ImportProductSimple2_Configurable
17+
ImportProductSimple3_Configurable
18+
placeholderBaseImage
19+
placeholderSmallImage
20+
placeholderThumbnailImage
21+
AdminImportTaxRatesTest
22+
AdminMediaGalleryFolderData
23+
AdminMediaGalleryFolder2Data
24+
ImageUpload
25+
AdminLoginActionGroup
26+
AdminOpenStandaloneMediaGalleryActionGroup
27+
ResetAdminDataGridToDefaultViewActionGroup
28+
AdminMediaGalleryFolderSelectActionGroup
29+
AdminMediaGalleryOpenNewFolderFormActionGroup
30+
AdminMediaGalleryCreateNewFolderActionGroup
31+
AdminEnhancedMediaGalleryUploadImageActionGroup
32+
AdminExpandMediaGalleryFolderActionGroup
33+
AdminMediaGalleryFolderDeleteActionGroup
34+
AdminLogoutActionGroup
35+
NavigateToCreatedCMSPageActionGroup
36+
AdminOpenMediaGalleryFromPageNoEditorActionGroup
37+
AdminMediaGalleryClickImageInGridActionGroup
38+
AdminMediaGalleryClickAddSelectedActionGroup
39+
AdminSaveAndContinueEditCmsPageActionGroup
40+
NavigateToStorefrontForCreatedPageActionGroup
41+
AdminMediaGalleryAssertFolderDoesNotExistActionGroup
42+
AdminEnhancedMediaGalleryImageDeleteActionGroup
43+
AdminMediaGalleryAssertImageNotExistsInTheGridActionGroup
44+
StorefrontProductMediaSection
45+
RedPngImageContent
46+
BluePngImageContent
47+
MagentoPlaceHolderImageContent
48+
StorefrontOpenProductEntityPageActionGroup
49+
AdminGoToCacheManagementPageActionGroup
50+
AdminClickFlushCatalogImagesCacheActionGroup
51+
placeholderBaseImageLongName
52+
AdminAddImageForCategoryTest
53+
AdminAddImageToWYSIWYGBlockTest
54+
AdminAddImageToWYSIWYGCMSTest
55+
AdminAddImageToWYSIWYGNewsletterTest
56+
AdminAddRemoveDefaultVideoSimpleProductTest
57+
AdminProductFormSection
58+
AdminProductDownloadableSection
59+
downloadableData
60+
StorefrontProductInfoMainSection
61+
DownloadableProduct
62+
StorefrontDownloadableProductSection
63+
StorefrontDownloadableLinkSection
64+
CheckoutCartProductSection
65+
StorefrontCustomerDownloadableProductsSection
66+
downloadableLinkWithMaxDownloads
67+
downloadableLink
68+
downloadableSampleFile
69+
StorefrontCustomerLogoutActionGroup
70+
DeleteProductUsingProductGridActionGroup
71+
AdminOpenProductIndexPageActionGroup
72+
GoToSpecifiedCreateProductPageActionGroup
73+
FillMainProductFormNoWeightActionGroup
74+
AddDownloadableProductLinkWithMaxDownloadsActionGroup
75+
AddDownloadableProductLinkActionGroup
76+
AddDownloadableSampleFileActionGroup
77+
SaveProductFormActionGroup
78+
CliIndexerReindexActionGroup
79+
LoginToStorefrontActionGroup
80+
StorefrontCheckProductPriceInCategoryActionGroup
81+
AssertProductNameAndSkuInStorefrontProductPageActionGroup
82+
AssertStorefrontSeeElementActionGroup
83+
StorefrontAddProductToCartActionGroup
84+
StorefrontCartPageOpenActionGroup
85+
StorefrontOpenCheckoutPageActionGroup
86+
CheckoutSelectCheckMoneyOrderPaymentActionGroup
87+
ClickPlaceOrderActionGroup
88+
StorefrontClickOrderLinkFromCheckoutSuccessPageActionGroup
89+
AdminOpenOrderByEntityIdActionGroup
90+
StartCreateInvoiceFromOrderPageActionGroup
91+
SubmitInvoiceActionGroup
92+
StorefrontAssertDownloadableProductIsPresentInCustomerAccount
93+
AdminMarketingCreateSitemapEntityTest
94+
AdminMarketingSiteMapCreateNewTest
95+
CheckingRMAPrintTest
96+
ConfigurableProductChildImageShouldBeShownOnWishListTest
97+
StorefrontCaptchaOnCustomerLoginTest
98+
StorefrontPrintOrderGuestTest
99+
UpdateImageFileCustomerAttributeTest

0 commit comments

Comments
 (0)