Skip to content

Commit c61e201

Browse files
Merge pull request #9267 from magento-cia/cia-2.4.8-beta1-develop-2.4-develop-sync-09112024
Cia 2.4.8 beta1 develop 2.4 develop sync 09112024
2 parents a410237 + dc3a1c2 commit c61e201

File tree

422 files changed

+13835
-2820
lines changed

Some content is hidden

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

422 files changed

+13835
-2820
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/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/view/adminhtml/layout/default.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
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"/>

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/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);

app/code/Magento/Catalog/Block/Product/View/Options/Type/Date.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,10 @@ public function getCalendarDateHtml()
9393
$yearStart = $this->_catalogProductOptionTypeDate->getYearStart();
9494
$yearEnd = $this->_catalogProductOptionTypeDate->getYearEnd();
9595

96-
$dateFormat = $this->_localeDate->getDateFormatWithLongYear();
96+
$fieldsSeparator = '/';
97+
$fieldsOrder = $this->_catalogProductOptionTypeDate->getConfigData('date_fields_order') ?? '';
98+
$fieldsOrder = str_replace(",", $fieldsSeparator, $fieldsOrder);
99+
$dateFormat = $fieldsOrder !== "m/d/y" ? $fieldsOrder : $this->_localeDate->getDateFormatWithLongYear();
97100
/** Escape RTL characters which are present in some locales and corrupt formatting */
98101
$escapedDateFormat = preg_replace('/[^MmDdYy\/\.\-]/', '', $dateFormat);
99102
$value = null;

app/code/Magento/Catalog/Model/Product/Price/Validation/TierPriceValidator.php

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Magento\Catalog\Model\Product\Type;
1212
use Magento\Catalog\Model\ProductIdLocatorInterface;
1313
use Magento\Customer\Api\GroupRepositoryInterface;
14+
use Magento\Directory\Model\Currency;
1415
use Magento\Framework\Api\FilterBuilder;
1516
use Magento\Framework\Api\SearchCriteriaBuilder;
1617
use Magento\Framework\Exception\LocalizedException;
@@ -426,7 +427,7 @@ private function checkUnique(
426427
foreach ($prices[$tierPrice->getSku()] as $price) {
427428
if ($price !== $tierPrice) {
428429
$checkWebsiteValue = $isExistingPrice ? $this->compareWebsiteValue($price, $tierPrice)
429-
: ($price->getWebsiteId() == $tierPrice->getWebsiteId());
430+
: $this->compareWebsiteValueNewPrice($price, $tierPrice);
430431
if (strtolower($price->getCustomerGroup()) === strtolower($tierPrice->getCustomerGroup())
431432
&& $price->getQuantity() == $tierPrice->getQuantity()
432433
&& $checkWebsiteValue
@@ -547,6 +548,29 @@ private function compareWebsiteValue(TierPriceInterface $price, TierPriceInterfa
547548
&& $price->getWebsiteId() != $tierPrice->getWebsiteId();
548549
}
549550

551+
/**
552+
* Compare Website Values between for new price records
553+
*
554+
* @param TierPriceInterface $price
555+
* @param TierPriceInterface $tierPrice
556+
* @return bool
557+
*/
558+
private function compareWebsiteValueNewPrice(TierPriceInterface $price, TierPriceInterface $tierPrice): bool
559+
{
560+
if ($price->getWebsiteId() == $this->allWebsitesValue ||
561+
$tierPrice->getWebsiteId() == $this->allWebsitesValue
562+
) {
563+
$baseCurrency = $this->scopeConfig->getValue(Currency::XML_PATH_CURRENCY_BASE, 'default');
564+
$websiteId = max($price->getWebsiteId(), $tierPrice->getWebsiteId());
565+
$website = $this->websiteRepository->getById($websiteId);
566+
$websiteCurrency = $website->getBaseCurrencyCode();
567+
568+
return $baseCurrency == $websiteCurrency;
569+
}
570+
571+
return $price->getWebsiteId() == $tierPrice->getWebsiteId();
572+
}
573+
550574
/**
551575
* @inheritDoc
552576
*/

app/code/Magento/Catalog/Model/ProductRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,7 @@ private function getCollectionProcessor()
813813
{
814814
if (!$this->collectionProcessor) {
815815
$this->collectionProcessor = \Magento\Framework\App\ObjectManager::getInstance()->get(
816-
// phpstan:ignore "Class Magento\Catalog\Model\Api\SearchCriteria\ProductCollectionProcessor not found."
816+
// @phpstan-ignore-next-line - this is a virtual type defined in di.xml
817817
\Magento\Catalog\Model\Api\SearchCriteria\ProductCollectionProcessor::class
818818
);
819819
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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="AdminAddCustomizableOptionToSimpleProductActionGroup">
12+
<annotations>
13+
<description value="Add a custom option of type date to simple product." />
14+
</annotations>
15+
16+
<click selector="{{AdminProductCustomizableOptionSection.customizableOptionsToggle}}" stepKey="expandCustomOptions"/>
17+
<scrollTo selector="{{AdminProductCustomizableOptionSection.customizableOptionsToggle}}" stepKey="scrollToCustomizableOptions"/>
18+
19+
<click selector="{{AdminProductCustomizableOptionSection.addButtonOption}}" stepKey="clickAddButtonOption"/>
20+
<waitForElementVisible selector="{{AdminProductCustomizableOptionSection.customOptionXTitle}}" stepKey="waitForOptions"/>
21+
<fillField selector="{{AdminProductCustomizableOptionSection.customOptionXTitle}}" userInput="custom option 1" stepKey="fillOptionTitle"/>
22+
23+
<click selector="{{AdminProductCustomizableOptionSection.customOptionSelectType}}" stepKey="selectType"/>
24+
<click selector="{{AdminProductCustomizableOptionSection.customOptionSelectField}}" stepKey="selectField"/>
25+
<click selector="{{AdminProductCustomizableOptionSection.uncheckRequired}}" stepKey="uncheckRequired"/>
26+
<fillField selector="{{AdminProductCustomizableOptionSection.customizableOptionPrice}}" userInput="0" stepKey="fillPrice"/>
27+
28+
<waitForElementVisible selector="{{AdminProductCustomizableOptionSection.save}}" stepKey="waitForSaveButton"/>
29+
<click selector="{{AdminProductCustomizableOptionSection.save}}" stepKey="clickSaveButton"/>
30+
<waitForPageLoad stepKey="waitForAttributeToSave"/>
31+
<seeElement selector="{{AdminProductCustomizableOptionSection.successMessage}}" stepKey="seeSuccessMessage"/>
32+
</actionGroup>
33+
</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="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>

0 commit comments

Comments
 (0)