Skip to content

Commit 750dde7

Browse files
committed
Merge remote-tracking branch 'origin/2.4-develop' into Hammer_PlatForm_Health_246_Scope_29092022
2 parents 0abb00c + 5dc13c3 commit 750dde7

File tree

122 files changed

+3289
-122
lines changed

Some content is hidden

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

122 files changed

+3289
-122
lines changed

app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,6 @@ protected function _importData()
316316
} elseif (\Magento\ImportExport\Model\Import::BEHAVIOR_APPEND == $this->getBehavior()) {
317317
$this->saveAdvancedPricing();
318318
}
319-
320319
return true;
321320
}
322321

@@ -342,7 +341,7 @@ public function deleteAdvancedPricing()
342341
{
343342
$this->_cachedSkuToDelete = null;
344343
$listSku = [];
345-
while ($bunch = $this->_dataSourceModel->getNextBunch()) {
344+
while ($bunch = $this->_dataSourceModel->getNextUniqueBunch($this->getIds())) {
346345
foreach ($bunch as $rowNum => $rowData) {
347346
$this->validateRow($rowData, $rowNum);
348347
if (!$this->getErrorAggregator()->isRowInvalid($rowNum)) {
@@ -389,7 +388,7 @@ protected function saveAndReplaceAdvancedPrices()
389388
}
390389
$listSku = [];
391390
$tierPrices = [];
392-
while ($bunch = $this->_dataSourceModel->getNextBunch()) {
391+
while ($bunch = $this->_dataSourceModel->getNextUniqueBunch($this->getIds())) {
393392
$bunchTierPrices = [];
394393
foreach ($bunch as $rowNum => $rowData) {
395394
if (!$this->validateRow($rowData, $rowNum)) {

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ class AdvancedPricingTest extends AbstractImportTestCase
3939
/**
4040
* DB Table data
4141
*/
42-
const TABLE_NAME = 'tableName';
43-
const LINK_FIELD = 'linkField';
42+
public const TABLE_NAME = 'tableName';
43+
public const LINK_FIELD = 'linkField';
4444

4545
/**
4646
* @var ResourceFactory|MockObject
@@ -328,7 +328,7 @@ public function testSaveAndReplaceAdvancedPricesAddRowErrorCall(): void
328328
]
329329
];
330330
$this->dataSourceModel
331-
->method('getNextBunch')
331+
->method('getNextUniqueBunch')
332332
->willReturnOnConsecutiveCalls($testBunch);
333333
$this->advancedPricing->expects($this->once())->method('validateRow')->willReturn(false);
334334
$this->advancedPricing->method('saveProductPrices')->willReturnSelf();
@@ -400,7 +400,7 @@ public function testSaveAndReplaceAdvancedPricesAppendBehaviourDataAndCalls(
400400
->method('getBehavior')
401401
->willReturn(Import::BEHAVIOR_APPEND);
402402
$this->dataSourceModel
403-
->method('getNextBunch')
403+
->method('getNextUniqueBunch')
404404
->willReturnOnConsecutiveCalls($data);
405405
$advancedPricing->method('validateRow')->willReturn(true);
406406

@@ -524,7 +524,7 @@ public function testSaveAndReplaceAdvancedPricesReplaceBehaviourInternalCalls():
524524
Import::BEHAVIOR_REPLACE
525525
);
526526
$this->dataSourceModel
527-
->method('getNextBunch')
527+
->method('getNextUniqueBunch')
528528
->willReturnOnConsecutiveCalls($data);
529529
$this->advancedPricing->expects($this->once())->method('validateRow')->willReturn(true);
530530

@@ -577,7 +577,7 @@ public function testDeleteAdvancedPricingFormListSkuToDelete(): void
577577
];
578578

579579
$this->dataSourceModel
580-
->method('getNextBunch')
580+
->method('getNextUniqueBunch')
581581
->willReturnOnConsecutiveCalls($data);
582582
$this->advancedPricing->method('validateRow')->willReturn(true);
583583
$expectedSkuList = ['sku value'];

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
<group value="pr_exclude"/>
2222
</annotations>
2323
<before>
24+
<magentoCLI command="config:set {{EnableFlatRateConfigData.path}} {{EnableFlatRateConfigData.value}}" stepKey="enableFlatRate"/>
2425
<magentoCLI command="config:set admin/dashboard/enable_charts 1" stepKey="setEnableCharts"/>
2526
<actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanInvalidatedCaches">
2627
<argument name="tags" value="config full_page"/>
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="AdminVerifyStateProvinceRequiredOnAddingNewAddressPageTest">
12+
<annotations>
13+
<features value="Backend"/>
14+
<stories value="Verification of required fields on new address page test"/>
15+
<title value="Admin verifies State/Province should be required fields on add new address page test"/>
16+
<description value="Admin verifies State/Province should be required fields on add new address page test"/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="AC-3912"/>
19+
<group value="configuration"/>
20+
</annotations>
21+
<before>
22+
<!-- Set locale options to United Kingdom-->
23+
<magentoCLI stepKey="localeUK" command="config:set general/locale/code en_GB"/>
24+
<!-- Deploy static content with United Kingdom locale-->
25+
<magentoCLI command="setup:static-content:deploy en_GB" stepKey="deployStaticContentWithUnitedKingdomLocale"/>
26+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
27+
</before>
28+
<after>
29+
<!-- Set locale options to en_US-->
30+
<magentoCLI stepKey="localeUS" command="config:set general/locale/code en_US"/>
31+
<!-- Change Admin locale to default -->
32+
<actionGroup ref="SetAdminAccountActionGroup" stepKey="setAdminAccountToUnitedStates">
33+
<argument name="InterfaceLocaleByValue" value="en_US" />
34+
</actionGroup>
35+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
36+
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
37+
<argument name="indices" value=""/>
38+
</actionGroup>
39+
<actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache">
40+
<argument name="tags" value=""/>
41+
</actionGroup>
42+
</after>
43+
44+
<!-- Open Admin Store Configuration Page -->
45+
<actionGroup ref="AdminOpenStoreConfigPageActionGroup" stepKey="openStoreConfigPage" />
46+
47+
<!--"Choose United Kingdom" as State Option Required and save configuration -->
48+
<conditionalClick selector="{{StateOptionsSection.stateOptions}}" dependentSelector="{{StateOptionsSection.countriesWithRequiredRegions}}" visible="false" stepKey="expandStateOptionsTab"/>
49+
<waitForAjaxLoad stepKey="waitForAjax"/>
50+
<scrollTo selector="{{StateOptionsSection.countriesWithRequiredRegions}}" stepKey="scrollToForm"/>
51+
<selectOption selector="{{StateOptionsSection.countriesWithRequiredRegions}}" userInput="United Kingdom" stepKey="selectCountriesWithRequiredRegion"/>
52+
<click selector="#save" stepKey="saveStateOptionsConfig"/>
53+
<waitForPageLoad stepKey="waitForSavingConfig"/>
54+
55+
<!-- create customer on storefront -->
56+
<actionGroup ref="StorefrontOpenCustomerAccountCreatePageActionGroup" stepKey="openCreateAccountPage"/>
57+
<actionGroup ref="ReloadPageActionGroup" stepKey="refreshPage"/>
58+
<actionGroup ref="StorefrontFillCustomerAccountCreationFormActionGroup" stepKey="fillCreateAccountForm">
59+
<argument name="customer" value="Simple_US_Customer"/>
60+
</actionGroup>
61+
<actionGroup ref="StorefrontClickCreateAnAccountCustomerAccountCreationFormActionGroup" stepKey="submitCreateAccountForm"/>
62+
63+
<!-- Open AddressBook and set Country as "United Kingdom" -->
64+
<actionGroup ref="StorefrontCustomerGoToSidebarMenu" stepKey="goToAddressBookPage">
65+
<argument name="menu" value="Address Book"/>
66+
</actionGroup>
67+
68+
<!-- Choose Country as "United Kingdom" -->
69+
<selectOption selector="{{StorefrontCustomerAddressFormSection.country}}" userInput="United Kingdom" stepKey="selectCountry"/>
70+
<click selector="{{StorefrontCustomerAddressFormSection.saveAddress}}" stepKey="saveCustomerAddress"/>
71+
72+
<!-- Assert the error message -->
73+
<seeElement selector="{{StorefrontCustomerMessagesSection.assertErrorMessage}}" stepKey="assetErrorMessage"/>
74+
</test>
75+
</tests>

app/code/Magento/Bundle/Model/Product/Type.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class Type extends \Magento\Catalog\Model\Product\Type\AbstractType
3131
/**
3232
* Product type
3333
*/
34-
const TYPE_CODE = 'bundle';
34+
public const TYPE_CODE = 'bundle';
3535

3636
/**
3737
* Product is composite
@@ -52,6 +52,7 @@ class Type extends \Magento\Catalog\Model\Product\Type\AbstractType
5252
*
5353
* @var string
5454
* @deprecated 100.2.0
55+
* @see MAGETWO-71174
5556
*/
5657
protected $_keySelectionsCollection = '_cache_instance_selections_collection';
5758

@@ -91,14 +92,14 @@ class Type extends \Magento\Catalog\Model\Product\Type\AbstractType
9192
protected $_canConfigure = true;
9293

9394
/**
94-
* Catalog data
95+
* Catalog data helper
9596
*
9697
* @var \Magento\Catalog\Helper\Data
9798
*/
9899
protected $_catalogData = null;
99100

100101
/**
101-
* Catalog product
102+
* Catalog product helper
102103
*
103104
* @var \Magento\Catalog\Helper\Product
104105
*/
@@ -1286,7 +1287,7 @@ protected function checkIsAllRequiredOptions($product, $isStrictProcessMode, $op
12861287
{
12871288
if (!$product->getSkipCheckRequiredOption() && $isStrictProcessMode) {
12881289
foreach ($optionsCollection->getItems() as $option) {
1289-
if ($option->getRequired() && !isset($options[$option->getId()])) {
1290+
if ($option->getRequired() && empty($options[$option->getId()])) {
12901291
throw new \Magento\Framework\Exception\LocalizedException(
12911292
__('Please select all required options.')
12921293
);
@@ -1421,6 +1422,7 @@ protected function mergeSelectionsWithOptions($options, $selections)
14211422
/**
14221423
* Get prepared options with selection ids
14231424
*
1425+
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
14241426
* @param array $options
14251427
* @return array
14261428
*/
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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="AdminCustomizableOptionWithOneOptionActionGroup">
12+
<annotations>
13+
<description>Requires Navigation to the Product Creation page. Adds custom Option with one option.</description>
14+
</annotations>
15+
16+
<click selector="{{AdminProductFormBundleSection.customizableOptionsToggle}}" stepKey="expandCustomOptions"/>
17+
<scrollTo selector="{{AdminProductFormBundleSection.customizableOptionsToggle}}" stepKey="scrollUpABit"/>
18+
<wait stepKey="waitForScroll" time="10"/>
19+
<click selector="{{AdminProductFormBundleSection.addButtonOption}}" stepKey="clickAddButtonOption"/>
20+
<waitForElementVisible selector="{{AdminProductFormBundleSection.customOptionXTitle}}" stepKey="waitForOptions"/>
21+
<fillField selector="{{AdminProductFormBundleSection.customOptionXTitle}}" userInput="op1" stepKey="fillOptionTitle"/>
22+
<wait stepKey="waitForFillTitle" time="10"/>
23+
<click selector="{{AdminProductFormBundleSection.customOptionSelectType}}" stepKey="selectType"/>
24+
<click selector="{{AdminProductFormBundleSection.customOptionSelectField}}" stepKey="selectField"/>
25+
<click selector="{{AdminProductFormBundleSection.uncheckRequired}}" stepKey="uncheckRequired"/>
26+
<fillField selector="{{AdminProductFormBundleSection.customizableOptionPrice}}" userInput="30" stepKey="fillPrice"/>
27+
<click selector="{{AdminProductFormBundleSection.priceType}}" stepKey="clickPriceType"/>
28+
<click selector="{{AdminProductFormBundleSection.priceTypeSelectPercent}}" stepKey="selectPercent"/>
29+
</actionGroup>
30+
</actionGroups>

app/code/Magento/Bundle/Test/Mftf/Section/AdminProductFormBundleSection.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,5 +113,16 @@
113113
<element name="userDefinedQuantity" type="checkbox" selector="[name='bundle_options[bundle_options][{{option}}][bundle_selections][{{product}}][selection_can_change_qty]'][type='checkbox']" parameterized="true"/>
114114
<element name="bundleItemsOptionTableRows" type="button" selector=".admin__dynamic-rows[data-index='bundle_selections'] tr.data-row" timeout="30"/>
115115
<element name="isDefault" type="button" selector="//table[@class='admin__dynamic-rows admin__control-table']//span[contains(text(),'{{var1}}')]/../../../../..//input[@type='radio']" parameterized="true"/>
116+
<!--Customizable Options -->
117+
<element name="customizableOptionsToggle" type="button" selector="//span[text()='Customizable Options']"/>
118+
<element name="addButtonOption" type="button" selector="button[data-index='button_add']"/>
119+
<element name="customOptionXTitle" type="input" selector="[name='product[options][0][title]']"/>
120+
<element name="customOptionSelectType" type="select" selector="[data-index='container_common'] .admin__action-multiselect-text"/>
121+
<element name="customOptionSelectField" type="select" selector="//label[contains(text(),'Field')]" />
122+
<element name="uncheckRequired" type="checkbox" selector="//span[contains(text(),'Required')]"/>
123+
<element name="addButton" type="button" selector="//span[contains(text(),'Add Value')]"/>
124+
<element name="customizableOptionPrice" type="input" selector=".//*[@name='product[options][0][price]']" />
125+
<element name="priceType" type="select" selector="[name='product[options][0][price_type]']" />
126+
<element name="priceTypeSelectPercent" type="select" selector="//*[@name='product[options][0][price_type]']/option[2]" />
116127
</section>
117128
</sections>

app/code/Magento/Bundle/Test/Mftf/Section/StorefrontBundledSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,6 @@
5050
<element name="validationMessageBox" type="block" selector="#validation-message-box"/>
5151
<element name="dropDownQuantityValidation" type="input" selector="//span[contains(text(), '{{productName}}')]/../..//input/following-sibling::div[@class='mage-error']" parameterized="true"/>
5252
<element name="radioButtonQuantityValidation" type="input" selector="//label//span[contains(text(), '{{productName}}')]/../..//div[@class='control']//div[@class='field qty qty-holder']//input/following-sibling::div[@class='mage-error']" parameterized="true"/>
53+
<element name="dropDrownOptionQuantity" type="input" selector="//span[contains(text(), '{{productName}}')]/../..//input/following-sibling::div//div//div//input" parameterized="true"/>
5354
</section>
5455
</sections>

app/code/Magento/Bundle/Test/Mftf/Section/StorefrontProductActionSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@
1313
<element name="addToCartButton" type="button" selector="#product-addtocart-button" timeout="30"/>
1414
<element name="dropdownSelectOption" type="select" selector="//div[@class='control']/select"/>
1515
<element name="dropdownProductSelection" type="select" selector="//div[@class='control']/select/option[contains(.,'{{productName}}')]" parameterized="true"/>
16+
<element name="customOptionField" type="select" selector="[class='input-text product-custom-option']"/>
1617
</section>
1718
</sections>
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
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+
<!-- Test XML Example -->
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="AdminBundleProductPriceCalculationOnProductPageTest">
11+
<annotations>
12+
<features value="Bundle"/>
13+
<stories value="Create bundle product in Admin and calculate price on product page"/>
14+
<title value="Bundle product price calculation on product page"/>
15+
<description value="create bundle product calculate and Verify price on product page"/>
16+
<severity value="MAJOR"/>
17+
<testCaseId value="AC-4610"/>
18+
</annotations>
19+
<before>
20+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
21+
<createData entity="SimpleSubCategory" stepKey="createCategory"/>
22+
<createData entity="ImportProductSimple2_Bundle" stepKey="simpleProduct">
23+
<field key="price">560</field>
24+
<requiredEntity createDataKey="createCategory"/>
25+
</createData>
26+
</before>
27+
<after>
28+
<!-- Delete bundle product -->
29+
<actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteBundleProduct">
30+
<argument name="product" value="BundleProduct"/>
31+
</actionGroup>
32+
<!-- deleting category, simple products -->
33+
<deleteData createDataKey="simpleProduct" stepKey="deleteProduct"/>
34+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
35+
<magentoCron groups="index" stepKey="reindex"/>
36+
<actionGroup ref="CliCacheCleanActionGroup" stepKey="flushCache">
37+
<argument name="tags" value="full_page"/>
38+
</actionGroup>
39+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/>
40+
</after>
41+
<!-- Create Bundle product via Admin -->
42+
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="navigateToProductIndex"/>
43+
<actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetProductGridColumnsInitial"/>
44+
<actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateProduct">
45+
<argument name="product" value="BundleProduct"/>
46+
</actionGroup>
47+
<!-- Entering Bundle Product name,SKU, category, url key -->
48+
<fillField selector="{{AdminProductFormSection.productName}}" userInput="{{BundleProduct.name}}" stepKey="fillProductName"/>
49+
<searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[$$createCategory.name$$]" stepKey="fillCategory"/>
50+
<!-- Add the bundle option to the product -->
51+
<actionGroup ref="AddBundleOptionWithOneProductActionGroup" stepKey="addBundleOption">
52+
<argument name="x" value="0"/>
53+
<argument name="n" value="1"/>
54+
<argument name="prodOneSku" value="$$simpleProduct.sku$$"/>
55+
<argument name="prodTwoSku" value=""/>
56+
<argument name="optionTitle" value="{{BundleProduct.optionTitle1}}"/>
57+
<argument name="inputType" value="Drop-down"/>
58+
</actionGroup>
59+
<checkOption selector="{{AdminProductFormBundleSection.userDefinedQuantity('0', '0')}}" stepKey="userDefinedQuantity"/>
60+
<!-- Save the bundle product -->
61+
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductForm"/>
62+
<!-- go to product page -->
63+
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="GoToProductPage">
64+
<argument name="productUrl" value="{{BundleProduct.urlKey}}"/>
65+
</actionGroup>
66+
<!-- update quantity and verify price -->
67+
<click selector="{{StorefrontBundledSection.addToCart}}" stepKey="clickCustomizeAndAddToCart"/>
68+
<wait stepKey="waitForClickOnCartButton" time="10"/>
69+
<fillField selector="{{StorefrontBundledSection.dropDrownOptionQuantity('$$simpleProduct.name$$')}}" userInput="3" stepKey="fillQuantity"/>
70+
<wait stepKey="waitForFillQuantityField" time="10"/>
71+
<click selector="{{StorefrontBundledSection.addToCartConfigured}}" stepKey="clickAddToCart"/>
72+
<!-- Storefront: Verify Updated Customization Price -->
73+
<see userInput="$1,680.00" selector="{{StorefrontBundledSection.bundleProductsPrice}}" stepKey="seeCustomizationPrice"/>
74+
</test>
75+
</tests>
76+

app/code/Magento/BundleGraphQl/Model/Resolver/Options/Collection.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,15 @@ private function fetch() : array
112112

113113
$productTable = $optionsCollection->getTable('catalog_product_entity');
114114
$linkField = $optionsCollection->getConnection()->getAutoIncrementField($productTable);
115+
$entityIds = array_column($this->skuMap, 'entity_id');
116+
115117
$optionsCollection->getSelect()->join(
116118
['cpe' => $productTable],
117119
'cpe.' . $linkField . ' = main_table.parent_id',
118120
[]
119121
)->where(
120122
"cpe.entity_id IN (?)",
121-
$this->skuMap
123+
$entityIds
122124
);
123125
$optionsCollection->setPositionOrder();
124126

0 commit comments

Comments
 (0)