Skip to content

Commit 7bd8e06

Browse files
authored
Merge branch '2.4-develop' into paypalflowpro-graphql
2 parents 1baeb21 + 3008324 commit 7bd8e06

File tree

595 files changed

+13398
-2231
lines changed

Some content is hidden

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

595 files changed

+13398
-2231
lines changed

README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
<p align="center">
2-
<a href="https://magento.com">
3-
<img src="https://static.magento.com/sites/all/themes/magento/logo.svg" width="300px" alt="Magento" />
4-
</a>
5-
</p>
6-
<p align="center">
7-
<br /><br />
2+
<a href="https://magento.com">
3+
<img src="https://static.magento.com/sites/all/themes/magento/logo.svg" width="300px" alt="Magento Commerce" />
4+
</a>
5+
<br />
6+
<br />
87
<a href="https://www.codetriage.com/magento/magento2">
98
<img src="https://www.codetriage.com/magento/magento2/badges/users.svg" alt="Open Source Helpers" />
109
</a>

app/code/Magento/Analytics/Model/ReportWriter.php

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
7+
68
namespace Magento\Analytics\Model;
79

810
use Magento\Analytics\ReportXml\DB\ReportValidator;
911
use Magento\Framework\Filesystem\Directory\WriteInterface;
1012

1113
/**
1214
* Writes reports in files in csv format
13-
* @inheritdoc
1415
*/
1516
class ReportWriter implements ReportWriterInterface
1617
{
@@ -54,7 +55,7 @@ public function __construct(
5455
}
5556

5657
/**
57-
* {@inheritdoc}
58+
* @inheritdoc
5859
*/
5960
public function write(WriteInterface $directory, $path)
6061
{
@@ -81,7 +82,7 @@ public function write(WriteInterface $directory, $path)
8182
$headers = array_keys($row);
8283
$stream->writeCsv($headers);
8384
}
84-
$stream->writeCsv($row);
85+
$stream->writeCsv($this->prepareRow($row));
8586
}
8687
$stream->unlock();
8788
$stream->close();
@@ -98,4 +99,18 @@ public function write(WriteInterface $directory, $path)
9899

99100
return true;
100101
}
102+
103+
/**
104+
* Replace wrong symbols in row
105+
*
106+
* @param array $row
107+
* @return array
108+
*/
109+
private function prepareRow(array $row): array
110+
{
111+
$row = preg_replace('/(?<!\\\\)"/', '\\"', $row);
112+
$row = preg_replace('/[\\\\]+/', '\\', $row);
113+
114+
return $row;
115+
}
101116
}

app/code/Magento/Analytics/Test/Unit/Model/ReportWriterTest.php

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
use Magento\Analytics\Model\ReportWriter;
1313
use Magento\Analytics\ReportXml\DB\ReportValidator;
1414
use Magento\Analytics\ReportXml\ReportProvider;
15-
use Magento\Framework\Filesystem\Directory\WriteInterface;
15+
use Magento\Framework\Filesystem\Directory\WriteInterface as DirectoryWriteInterface;
16+
use Magento\Framework\Filesystem\File\WriteInterface as FileWriteInterface;
1617
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
1718
use PHPUnit\Framework\MockObject\MockObject;
1819
use PHPUnit\Framework\TestCase;
@@ -48,7 +49,7 @@ class ReportWriterTest extends TestCase
4849
private $objectManagerHelper;
4950

5051
/**
51-
* @var WriteInterface|MockObject
52+
* @var DirectoryWriteInterface|MockObject
5253
*/
5354
private $directoryMock;
5455

@@ -82,7 +83,7 @@ protected function setUp(): void
8283
$this->reportValidatorMock = $this->createMock(ReportValidator::class);
8384
$this->providerFactoryMock = $this->createMock(ProviderFactory::class);
8485
$this->reportProviderMock = $this->createMock(ReportProvider::class);
85-
$this->directoryMock = $this->getMockBuilder(WriteInterface::class)
86+
$this->directoryMock = $this->getMockBuilder(DirectoryWriteInterface::class)
8687
->getMockForAbstractClass();
8788
$this->objectManagerHelper = new ObjectManagerHelper($this);
8889

@@ -98,16 +99,15 @@ protected function setUp(): void
9899

99100
/**
100101
* @param array $configData
102+
* @param array $fileData
103+
* @param array $expectedFileData
101104
* @return void
102105
*
103106
* @dataProvider configDataProvider
104107
*/
105-
public function testWrite(array $configData)
108+
public function testWrite(array $configData, array $fileData, array $expectedFileData): void
106109
{
107110
$errors = [];
108-
$fileData = [
109-
['number' => 1, 'type' => 'Shoes Usual']
110-
];
111111
$this->configInterfaceMock
112112
->expects($this->once())
113113
->method('get')
@@ -126,7 +126,7 @@ public function testWrite(array $configData)
126126
->with($parameterName ?: null)
127127
->willReturn($fileData);
128128
$errorStreamMock = $this->getMockBuilder(
129-
\Magento\Framework\Filesystem\File\WriteInterface::class
129+
FileWriteInterface::class
130130
)->getMockForAbstractClass();
131131
$errorStreamMock
132132
->expects($this->once())
@@ -136,8 +136,8 @@ public function testWrite(array $configData)
136136
->expects($this->exactly(2))
137137
->method('writeCsv')
138138
->withConsecutive(
139-
[array_keys($fileData[0])],
140-
[$fileData[0]]
139+
[array_keys($expectedFileData[0])],
140+
[$expectedFileData[0]]
141141
);
142142
$errorStreamMock->expects($this->once())->method('unlock');
143143
$errorStreamMock->expects($this->once())->method('close');
@@ -164,12 +164,12 @@ public function testWrite(array $configData)
164164
*
165165
* @dataProvider configDataProvider
166166
*/
167-
public function testWriteErrorFile($configData)
167+
public function testWriteErrorFile(array $configData): void
168168
{
169169
$errors = ['orders', 'SQL Error: test'];
170170
$this->configInterfaceMock->expects($this->once())->method('get')->willReturn([$configData]);
171171
$errorStreamMock = $this->getMockBuilder(
172-
\Magento\Framework\Filesystem\File\WriteInterface::class
172+
FileWriteInterface::class
173173
)->getMockForAbstractClass();
174174
$errorStreamMock->expects($this->once())->method('lock');
175175
$errorStreamMock->expects($this->once())->method('writeCsv')->with($errors);
@@ -184,7 +184,7 @@ public function testWriteErrorFile($configData)
184184
/**
185185
* @return void
186186
*/
187-
public function testWriteEmptyReports()
187+
public function testWriteEmptyReports(): void
188188
{
189189
$this->configInterfaceMock->expects($this->once())->method('get')->willReturn([]);
190190
$this->reportValidatorMock->expects($this->never())->method('validate');
@@ -195,11 +195,11 @@ public function testWriteEmptyReports()
195195
/**
196196
* @return array
197197
*/
198-
public function configDataProvider()
198+
public function configDataProvider(): array
199199
{
200200
return [
201201
'reportProvider' => [
202-
[
202+
'configData' => [
203203
'providers' => [
204204
[
205205
'name' => $this->providerName,
@@ -209,6 +209,12 @@ public function configDataProvider()
209209
],
210210
]
211211
]
212+
],
213+
'fileData' => [
214+
['number' => 1, 'type' => 'Shoes\"" Usual\\\\"']
215+
],
216+
'expectedFileData' => [
217+
['number' => 1, 'type' => 'Shoes\"\" Usual\\"']
212218
]
213219
],
214220
];

app/code/Magento/AsynchronousOperations/Model/MassConsumer.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,19 @@ public function process($maxNumberOfMessages = null)
6969
$this->registry->register('isSecureArea', true, true);
7070

7171
$queue = $this->configuration->getQueue();
72+
$maxIdleTime = $this->configuration->getMaxIdleTime();
73+
$sleep = $this->configuration->getSleep();
7274

7375
if (!isset($maxNumberOfMessages)) {
7476
$queue->subscribe($this->getTransactionCallback($queue));
7577
} else {
76-
$this->invoker->invoke($queue, $maxNumberOfMessages, $this->getTransactionCallback($queue));
78+
$this->invoker->invoke(
79+
$queue,
80+
$maxNumberOfMessages,
81+
$this->getTransactionCallback($queue),
82+
$maxIdleTime,
83+
$sleep
84+
);
7785
}
7886

7987
$this->registry->unregister('isSecureArea');

app/code/Magento/Backend/Test/Mftf/Test/AdminDashboardWithChartsTest.xml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,11 @@
8989
<waitForPageLoad stepKey="waitForInvoicePageToLoad"/>
9090
<see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Invoice" stepKey="seeNewInvoiceInPageTitle" after="clickInvoiceButton"/>
9191
<see selector="{{AdminInvoiceTotalSection.total('Subtotal')}}" userInput="$150.00" stepKey="seeCorrectGrandTotal"/>
92-
<click selector="{{AdminInvoiceMainActionsSection.submitInvoice}}" stepKey="clickSubmitInvoice"/>
92+
<actionGroup ref="AdminInvoiceClickSubmitActionGroup" stepKey="clickSubmitInvoice"/>
9393
<see selector="{{AdminOrderDetailsMessagesSection.successMessage}}" userInput="The invoice has been created." stepKey="seeSuccessInvoiceMessage"/>
9494
<!--Create Shipment for the order-->
9595
<comment userInput="Create Shipment for the order" stepKey="createShipmentForOrder"/>
96-
<amOnPage url="{{AdminOrdersPage.url}}" stepKey="onOrdersPage2"/>
97-
<waitForPageLoad time="30" stepKey="waitForOrderListPageLoading"/>
96+
<actionGroup ref="AdminOrdersPageOpenActionGroup" stepKey="onOrdersPage2"/>
9897
<actionGroup ref="AdminOrderGridClickFirstRowActionGroup" stepKey="openOrderPageForShip"/>
9998
<click selector="{{AdminOrderDetailsMainActionsSection.ship}}" stepKey="clickShipAction"/>
10099
<waitForPageLoad stepKey="waitForShipmentPagePage"/>

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@
3131
</after>
3232

3333
<!-- Create a bundle product -->
34-
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPageBundle"/>
35-
<waitForPageLoad stepKey="waitForProductPageLoadBundle"/>
34+
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="visitAdminProductPageBundle"/>
3635
<actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateBundleProduct">
3736
<argument name="product" value="BundleProduct"/>
3837
</actionGroup>

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,9 @@
4040
<amOnPage url="{{StorefrontProductPage.url($$createDynamicBundleProduct.name$$)}}" stepKey="amOnBundleProductPage"/>
4141
<see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="Whoops, our bad..." stepKey="seeWhoops"/>
4242
<!-- Search for the product by sku -->
43-
<fillField selector="{{StorefrontQuickSearchSection.searchPhrase}}" userInput="$$createDynamicBundleProduct.sku$$" stepKey="fillSearchBarByProductSku"/>
44-
<waitForPageLoad stepKey="waitForSearchButton"/>
45-
<click selector="{{StorefrontQuickSearchSection.searchButton}}" stepKey="clickSearchButton"/>
46-
<waitForPageLoad stepKey="waitForSearchResults"/>
43+
<actionGroup ref="StoreFrontQuickSearchActionGroup" stepKey="searchByCreatedTerm">
44+
<argument name="query" value="$$createDynamicBundleProduct.sku$$"/>
45+
</actionGroup>
4746
<!-- Should not see any search results -->
4847
<dontSee userInput="$$createDynamicBundleProduct.sku$$" selector="{{StorefrontCatalogSearchMainSection.searchResults}}" stepKey="dontSeeProduct"/>
4948
<see selector="{{StorefrontCatalogSearchMainSection.message}}" userInput="Your search returned no results." stepKey="seeCantFindProductOneMessage"/>

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,9 @@
3737
<amOnPage url="{{StorefrontProductPage.url($$createFixedBundleProduct.name$$)}}" stepKey="amOnBundleProductPage"/>
3838
<see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="Whoops, our bad..." stepKey="seeWhoops"/>
3939
<!-- Search for the product by sku -->
40-
<fillField selector="{{StorefrontQuickSearchSection.searchPhrase}}" userInput="$$createFixedBundleProduct.sku$$" stepKey="fillSearchBarByProductSku"/>
41-
<waitForPageLoad stepKey="waitForSearchButton"/>
42-
<click selector="{{StorefrontQuickSearchSection.searchButton}}" stepKey="clickSearchButton"/>
43-
<waitForPageLoad stepKey="waitForSearchResults"/>
40+
<actionGroup ref="StoreFrontQuickSearchActionGroup" stepKey="searchByCreatedTerm">
41+
<argument name="query" value="$$createFixedBundleProduct.sku$$"/>
42+
</actionGroup>
4443
<!-- Should not see any search results -->
4544
<dontSee userInput="$$createFixedBundleProduct.sku$$" selector="{{StorefrontCatalogSearchMainSection.searchResults}}" stepKey="dontSeeProduct"/>
4645
<see selector="{{StorefrontCatalogSearchMainSection.message}}" userInput="Your search returned no results." stepKey="seeCantFindProductOneMessage"/>

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@
3737
</after>
3838

3939
<!-- Create a bundle product -->
40-
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPageBundle"/>
41-
<waitForPageLoad stepKey="waitForProductPageLoadBundle"/>
40+
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="visitAdminProductPageBundle"/>
4241
<actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateBundleProduct">
4342
<argument name="product" value="BundleProduct"/>
4443
</actionGroup>

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@
3535
</after>
3636

3737
<!-- Create a bundle product -->
38-
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPageBundle"/>
39-
<waitForPageLoad stepKey="waitForProductPageLoadBundle"/>
38+
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="visitAdminProductPageBundle"/>
4039
<actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateBundleProduct">
4140
<argument name="product" value="BundleProduct"/>
4241
</actionGroup>

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,7 @@
7676
<seeElement stepKey="LookingForNameOfProduct" selector="{{StorefrontBundledSection.bundleProductName}}"/>
7777

7878
<!--Testing disabled view-->
79-
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="GoToProductCatalog"/>
80-
<waitForPageLoad stepKey="WaitForCatalogProductPageToLoad"/>
79+
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="GoToProductCatalog"/>
8180
<actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="FindProductEditPage">
8281
<argument name="product" value="BundleProduct"/>
8382
</actionGroup>

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@
3535

3636
<!-- Create a product to appear in the widget, fill in basic info first -->
3737

38-
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductList"/>
39-
<waitForPageLoad stepKey="waitForProductList"/>
38+
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="amOnProductList"/>
4039
<click selector="{{AdminProductGridActionSection.addProductToggle}}" stepKey="clickAddProductToggle"/>
4140
<click selector="{{AdminProductGridActionSection.addBundleProduct}}" stepKey="clickAddBundleProduct"/>
4241
<fillField selector="{{AdminProductFormSection.productName}}" userInput="{{_defaultProduct.name}}" stepKey="fillProductName"/>

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@
5353
</after>
5454

5555
<!-- Start creating a bundle product -->
56-
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToProductList"/>
57-
<waitForPageLoad stepKey="waitForProductList"/>
56+
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="goToProductList"/>
5857
<actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateProduct">
5958
<argument name="product" value="BundleProduct"/>
6059
</actionGroup>

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@
3131
</after>
3232

3333
<!-- Create a bundle product -->
34-
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPageBundle"/>
35-
<waitForPageLoad stepKey="waitForProductPageLoadBundle"/>
34+
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="visitAdminProductPageBundle"/>
3635
<actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateBundleProduct">
3736
<argument name="product" value="BundleProduct"/>
3837
</actionGroup>
@@ -84,8 +83,7 @@
8483
<grabTextFrom selector="{{CheckoutCartProductSection.nthBundleOptionName('1')}}" stepKey="grabTotalBefore"/>
8584

8685
<!-- Find the product that we just created using the product grid -->
87-
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/>
88-
<waitForPageLoad stepKey="waitForAdminProductPageLoad"/>
86+
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="visitAdminProductPage"/>
8987
<conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/>
9088
<actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="findCreatedProduct">
9189
<argument name="product" value="BundleProduct"/>

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@
3030
</after>
3131

3232
<!-- Start creating a bundle product -->
33-
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToProductList"/>
34-
<waitForPageLoad stepKey="waitForProductList"/>
33+
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="goToProductList"/>
3534
<actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateProduct">
3635
<argument name="product" value="BundleProduct"/>
3736
</actionGroup>

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@
3131
</after>
3232

3333
<!-- Start creating a bundle product -->
34-
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToProductList"/>
35-
<waitForPageLoad stepKey="waitForProductList"/>
34+
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="goToProductList"/>
3635
<actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateProduct">
3736
<argument name="product" value="BundleProduct"/>
3837
</actionGroup>

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@
3636
</after>
3737

3838
<!-- Start creating a bundle product -->
39-
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToProductList"/>
40-
<waitForPageLoad stepKey="waitForProductList"/>
39+
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="goToProductList"/>
4140
<actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateProduct">
4241
<argument name="product" value="BundleProduct"/>
4342
</actionGroup>

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@
3131
</after>
3232

3333
<!-- Create a bundle product -->
34-
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPageBundle"/>
35-
<waitForPageLoad stepKey="waitForProductPageLoadBundle"/>
34+
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="visitAdminProductPageBundle"/>
3635
<actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateBundleProduct">
3736
<argument name="product" value="BundleProduct"/>
3837
</actionGroup>

0 commit comments

Comments
 (0)