Skip to content

Commit 21e3f48

Browse files
authored
Merge branch '2.4-develop' into fix-for-issue-38758
2 parents 671583d + b34c0a7 commit 21e3f48

File tree

201 files changed

+4826
-1723
lines changed

Some content is hidden

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

201 files changed

+4826
-1723
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/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);

app/code/Magento/BundleImportExport/Test/Unit/Model/Import/Product/Type/BundleTest.php

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
use Magento\Framework\EntityManager\MetadataPool;
2323
use Magento\ImportExport\Model\Import;
2424
use Magento\ImportExport\Test\Unit\Model\Import\AbstractImportTestCase;
25+
use Magento\Store\Model\StoreManagerInterface;
2526
use PHPUnit\Framework\MockObject\MockObject;
2627

2728
/**
@@ -208,6 +209,19 @@ protected function setUp(): void
208209
->disableOriginalConstructor()
209210
->onlyMethods(['getScope'])
210211
->getMockForAbstractClass();
212+
213+
$objects = [
214+
[
215+
Bundle\RelationsDataSaver::class,
216+
$this->createMock(Bundle\RelationsDataSaver::class)
217+
],
218+
[
219+
StoreManagerInterface::class,
220+
$this->createMock(StoreManagerInterface::class)
221+
]
222+
];
223+
$this->objectManagerHelper->prepareObjectManager($objects);
224+
211225
$this->bundle = $this->objectManagerHelper->getObject(
212226
Bundle::class,
213227
[
@@ -248,9 +262,12 @@ public function testSaveData(array $skus, array $bunch, bool $allowImport): void
248262
{
249263
$this->entityModel->expects($this->any())->method('getBehavior')->willReturn(Import::BEHAVIOR_APPEND);
250264
$this->entityModel->expects($this->once())->method('getNewSku')->willReturn($skus['newSku']);
265+
$callCount = 0;
251266
$this->entityModel
252267
->method('getNextBunch')
253-
->willReturnOnConsecutiveCalls([$bunch]);
268+
->willReturnCallback(function () use (&$callCount, $bunch) {
269+
return $callCount++ === 0 ? [$bunch] : null;
270+
});
254271
$this->entityModel->expects($this->any())->method('isRowAllowedToImport')->willReturn($allowImport);
255272
$scope = $this->getMockBuilder(ScopeInterface::class)->getMockForAbstractClass();
256273
$this->scopeResolver->expects($this->any())->method('getScope')->willReturn($scope);
@@ -321,7 +338,7 @@ public function testSaveData(array $skus, array $bunch, bool $allowImport): void
321338
*
322339
* @return array
323340
*/
324-
public function saveDataProvider(): array
341+
public static function saveDataProvider(): array
325342
{
326343
return [
327344
[
@@ -395,13 +412,12 @@ public function testSaveDataDelete(): void
395412
$this->entityModel->expects($this->once())->method('getNewSku')->willReturn([
396413
'sku' => ['sku' => 'sku', 'entity_id' => 3, 'attr_set_code' => 'Default', 'type_id' => 'bundle']
397414
]);
415+
$callCount = 0;
398416
$this->entityModel
399417
->method('getNextBunch')
400-
->willReturnOnConsecutiveCalls(
401-
[
402-
['bundle_values' => 'value1', 'sku' => 'sku', 'name' => 'name']
403-
]
404-
);
418+
->willReturnCallback(function () use (&$callCount) {
419+
return $callCount++ === 0 ? [['bundle_values' => 'value1', 'sku' => 'sku', 'name' => 'name']] : null;
420+
});
405421
$this->entityModel->expects($this->any())->method('isRowAllowedToImport')->willReturn(true);
406422
$select = $this->createMock(Select::class);
407423
$this->connection->expects($this->any())->method('select')->willReturn($select);
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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="AdminAddTextSwatchForAdminActionGroup">
12+
<annotations>
13+
<description>Admin add texual swatch for admin.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="position" type="string"/>
17+
<argument name="swatchName" type="string"/>
18+
<argument name="swatchDescription" type="string"/>
19+
</arguments>
20+
<waitForElementVisible selector="{{AttributeManageSwatchSection.textSwatchAdminSwatchValue(position)}}" stepKey="waitForSwatchTextBoxForAdminToVisible"/>
21+
<fillField selector="{{AttributeManageSwatchSection.textSwatchAdminSwatchValue(position)}}" userInput="{{swatchName}}" stepKey="fillSwatchForAdmin"/>
22+
<waitForElementVisible selector="{{AttributeManageSwatchSection.textSwatchAdminDescriptionValue(position)}}" stepKey="waitForDescriptionTextBoxForAdminToVisible"/>
23+
<fillField selector="{{AttributeManageSwatchSection.textSwatchAdminDescriptionValue(position)}}" userInput="{{swatchDescription}}" stepKey="fillDescriptionForAdmin"/>
24+
</actionGroup>
25+
</actionGroups>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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="AdminAddTextSwatchForStoreViewActionGroup">
12+
<annotations>
13+
<description>Admin add texual swatch for storeview.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="position" type="string"/>
17+
<argument name="swatchName" type="string"/>
18+
<argument name="swatchDescription" type="string"/>
19+
</arguments>
20+
<waitForElementVisible selector="{{AttributeManageSwatchSection.textSwatchDefaultStoreSwatchValue(position)}}" stepKey="waitForSwatchTextBoxForAdminToVisible"/>
21+
<fillField selector="{{AttributeManageSwatchSection.textSwatchDefaultStoreSwatchValue(position)}}" userInput="{{swatchName}}" stepKey="fillSwatchForStoreView"/>
22+
<waitForElementVisible selector="{{AttributeManageSwatchSection.textSwatchDefaultStoreDescriptionValue(position)}}" stepKey="waitForDescriptionTextBoxForAdminToVisible"/>
23+
<fillField selector="{{AttributeManageSwatchSection.textSwatchDefaultStoreDescriptionValue(position)}}" userInput="{{swatchDescription}}" stepKey="fillDescriptionForStoreView"/>
24+
</actionGroup>
25+
</actionGroups>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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="FilterProductGridByProductNameActionGroup">
12+
<annotations>
13+
<description>Filters the Admin Products grid by the provided Product (Name).</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="productName" type="string"/>
17+
</arguments>
18+
<conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/>
19+
<waitForElementClickable selector="{{AdminProductGridFilterSection.filters}}" stepKey="openForFilterField"/>
20+
<click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/>
21+
<waitForElementVisible selector="{{AdminProductGridFilterSection.nameFilter}}" stepKey="waitForFilterFieldToBecomeActive"/>
22+
<fillField selector="{{AdminProductGridFilterSection.nameFilter}}" userInput="{{productName}}" stepKey="fillProductName"/>
23+
<waitForElementClickable selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="waitToClickApplyFilter"/>
24+
<click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/>
25+
<waitForElementNotVisible selector="{{AdminProductGridSection.loadingMask}}" stepKey="waitForFilteredGridLoad" time="30"/>
26+
</actionGroup>
27+
</actionGroups>
28+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="StorefrontAssertAddToCartButtonNotPresentOnProductPageActionGroup">
11+
<annotations>
12+
<description>Validate "Add to Cart" button is NOT present on product page.</description>
13+
</annotations>
14+
<waitForElementNotVisible selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addToCartButtonNotPresent"/>
15+
</actionGroup>
16+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="StorefrontAssertProductPriceNotPresentOnProductPageActionGroup">
11+
<annotations>
12+
<description>Validate that the provided Product Price is NOT present on product page.</description>
13+
</annotations>
14+
<waitForElementNotVisible selector="{{StorefrontProductInfoMainSection.price}}" stepKey="verifyProductPriceNotVisible"/>
15+
</actionGroup>
16+
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/Section/AdminCreateProductAttributeSection/AttributeManageSwatchSection.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,11 @@
1414
<element name="descriptionField1" type="input" selector="(//th[contains(@class, 'col-swatch')]/span[contains(text(), '{{arg}}')]/ancestor::thead/following-sibling::tbody//input[@placeholder='Description'])[2]" parameterized="true"/>
1515
<element name="swatchField2" type="input" selector="(//th[contains(@class, 'col-swatch')]/span[contains(text(), '{{arg}}')]/ancestor::thead/following-sibling::tbody//input[@placeholder='Swatch'])[3]" parameterized="true"/>
1616
<element name="descriptionField2" type="input" selector="(//th[contains(@class, 'col-swatch')]/span[contains(text(), '{{arg}}')]/ancestor::thead/following-sibling::tbody//input[@placeholder='Description'])[3]" parameterized="true"/>
17+
<element name="textSwatchAdminSwatchValue" type="input" selector="[data-role='swatch-text-options-container'] input[name='swatchtext[value][option_{{row}}][0]']" parameterized="true"/>
18+
<element name="textSwatchAdminDescriptionValue" type="input" selector="[data-role='swatch-text-options-container'] input[name='optiontext[value][option_{{row}}][0]']" parameterized="true"/>
19+
<element name="textSwatchDefaultStoreSwatchValue" type="input" selector="[data-role='swatch-text-options-container'] input[name='swatchtext[value][option_{{row}}][1]']" parameterized="true"/>
20+
<element name="textSwatchDefaultStoreDescriptionValue" type="input" selector="[data-role='swatch-text-options-container'] input[name='optiontext[value][option_{{row}}][1]']" parameterized="true"/>
21+
<element name="textSwatchStoreViewValue" type="input" selector="//*[@data-role='swatch-text-options-container']//td[starts-with(@class,'col-swatch col-swatch')]//input[@value='{{storeViewValue}}']" parameterized="true"/>
22+
<element name="isDefaultTextSwatch" type="radio" selector="[data-role='swatch-text-options-container'] tr:nth-of-type({{row}}) input[name='defaulttext[]']" parameterized="true"/>
1723
</section>
1824
</sections>

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
<useCaseId value="MAGETWO-70232"/>
2020
<group value="catalog"/>
2121
<group value="cloud"/>
22+
<!-- Will be fixed in the scope of ACQE-6795 -->
23+
<group value="pr_exclude"/>
2224
</annotations>
2325
<before>
2426
<!--Create category-->

0 commit comments

Comments
 (0)