Skip to content

Commit f7c59ba

Browse files
committed
Merge remote-tracking branch 'origin/2.4-develop' into refactor/mftf-customer
2 parents bf9315b + 49477e9 commit f7c59ba

File tree

32 files changed

+769
-171
lines changed

32 files changed

+769
-171
lines changed

app/code/Magento/Catalog/Controller/Adminhtml/Product/AddAttributeToTemplate.php

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@
1717
use Magento\Eav\Api\Data\AttributeGroupInterfaceFactory;
1818
use Magento\Eav\Api\Data\AttributeInterface;
1919
use Magento\Eav\Api\Data\AttributeSetInterface;
20+
use Magento\Eav\Model\Cache\Type as CacheType;
2021
use Magento\Framework\Api\ExtensionAttributesFactory;
2122
use Magento\Framework\Api\SearchCriteriaBuilder;
2223
use Magento\Framework\App\Action\HttpPostActionInterface;
24+
use Magento\Framework\App\CacheInterface;
2325
use Magento\Framework\App\ObjectManager;
2426
use Magento\Framework\Controller\Result\Json;
2527
use Magento\Framework\Controller\Result\JsonFactory;
@@ -29,7 +31,7 @@
2931
use Psr\Log\LoggerInterface;
3032

3133
/**
32-
* Class AddAttributeToTemplate
34+
* Assign attribute to attribute set.
3335
*
3436
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
3537
*/
@@ -80,6 +82,11 @@ class AddAttributeToTemplate extends Product implements HttpPostActionInterface
8082
*/
8183
protected $extensionAttributesFactory;
8284

85+
/**
86+
* @var CacheInterface
87+
*/
88+
private $cache;
89+
8390
/**
8491
* Constructor
8592
*
@@ -94,8 +101,8 @@ class AddAttributeToTemplate extends Product implements HttpPostActionInterface
94101
* @param AttributeManagementInterface $attributeManagement
95102
* @param LoggerInterface $logger
96103
* @param ExtensionAttributesFactory $extensionAttributesFactory
104+
* @param CacheInterface|null $cache
97105
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
98-
* @SuppressWarnings(PHPMD.LongVariable)
99106
* @SuppressWarnings(PHPMD.NPathComplexity)
100107
*/
101108
public function __construct(
@@ -109,7 +116,8 @@ public function __construct(
109116
SearchCriteriaBuilder $searchCriteriaBuilder = null,
110117
AttributeManagementInterface $attributeManagement = null,
111118
LoggerInterface $logger = null,
112-
ExtensionAttributesFactory $extensionAttributesFactory = null
119+
ExtensionAttributesFactory $extensionAttributesFactory = null,
120+
CacheInterface $cache = null
113121
) {
114122
parent::__construct($context, $productBuilder);
115123
$this->resultJsonFactory = $resultJsonFactory;
@@ -129,6 +137,7 @@ public function __construct(
129137
->get(LoggerInterface::class);
130138
$this->extensionAttributesFactory = $extensionAttributesFactory ?: ObjectManager::getInstance()
131139
->get(ExtensionAttributesFactory::class);
140+
$this->cache = $cache ?? ObjectManager::getInstance()->get(CacheInterface::class);
132141
}
133142

134143
/**
@@ -203,6 +212,7 @@ function (AttributeInterface $attribute) use ($attributeSet, $attributeGroup) {
203212
);
204213
}
205214
);
215+
$this->cache->clean([CacheType::CACHE_TAG]);
206216
} catch (LocalizedException $e) {
207217
$response->setError(true);
208218
$response->setMessage($e->getMessage());
@@ -223,7 +233,7 @@ function (AttributeInterface $attribute) use ($attributeSet, $attributeGroup) {
223233
*/
224234
private function getBasicAttributeSearchCriteriaBuilder()
225235
{
226-
$attributeIds = (array) $this->getRequest()->getParam('attributeIds', []);
236+
$attributeIds = (array)$this->getRequest()->getParam('attributeIds', []);
227237

228238
if (empty($attributeIds['selected'])) {
229239
throw new LocalizedException(__('Attributes were missing and must be specified.'));

app/code/Magento/Catalog/Model/Indexer/Category/Flat/Action/Full.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ protected function populateFlatTables(array $stores)
7979
}
8080
$category['store_id'] = $store->getId();
8181
$data[] = $this->prepareValuesToInsert(
82+
// phpcs:ignore Magento2.Performance.ForeachArrayMerge
8283
array_merge($category, $attributesData[$category[$linkField]])
8384
);
8485
}
@@ -183,7 +184,7 @@ private function getActualStoreTablesForCategoryFlat(): array
183184
foreach ($this->storeManager->getStores() as $store) {
184185
$actualStoreTables[] = sprintf(
185186
'%s_store_%s',
186-
$this->connection->getTableName('catalog_category_flat'),
187+
$this->connection->getTableName($this->getTableName('catalog_category_flat')),
187188
$store->getId()
188189
);
189190
}
@@ -199,7 +200,7 @@ private function getActualStoreTablesForCategoryFlat(): array
199200
private function deleteAbandonedStoreCategoryFlatTables(): void
200201
{
201202
$existentTables = $this->connection->getTables(
202-
$this->connection->getTableName('catalog_category_flat_store_%')
203+
$this->connection->getTableName($this->getTableName('catalog_category_flat_store_%'))
203204
);
204205
$actualStoreTables = $this->getActualStoreTablesForCategoryFlat();
205206

app/code/Magento/Catalog/Model/Indexer/Product/Flat/AbstractAction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ protected function _updateRelationProducts($storeId, $productIds = null)
222222
['t' => $this->_productIndexerHelper->getTable($relation->getTable())],
223223
['entity_table.entity_id', $relation->getChildFieldName(), new \Zend_Db_Expr('1')]
224224
)->join(
225-
['entity_table' => $this->_connection->getTableName('catalog_product_entity')],
225+
['entity_table' => $this->_productIndexerHelper->getTable('catalog_product_entity')],
226226
"entity_table.{$metadata->getLinkField()} = t.{$relation->getParentFieldName()}",
227227
[]
228228
)->join(
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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="AdminExpandProductAttributesTabActionGroup">
12+
<annotations>
13+
<description>Expands the 'Attributes' tab on the Admin Product page.</description>
14+
</annotations>
15+
16+
<scrollTo selector="{{AdminProductAttributeSection.attributeSectionHeader}}" stepKey="scrollToAttributesTab"/>
17+
<conditionalClick selector="{{AdminProductAttributeSection.attributeSectionHeader}}" dependentSelector="{{AdminProductAttributeSection.attributeSection}}" visible="false" stepKey="expandAttributesTab"/>
18+
</actionGroup>
19+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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="AssertStorefrontAttributeOptionPresentInLayeredNavigationActionGroup">
12+
<annotations>
13+
<description>Clicks on the attribute label. Checks for attribute option presence.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="attributeLabel" type="string" defaultValue="{{ProductAttributeFrontendLabel.label}}"/>
17+
<argument name="attributeOptionLabel" type="string" defaultValue="{{Option1Store0.label}}"/>
18+
<argument name="attributeOptionPosition" type="string" defaultValue="1"/>
19+
</arguments>
20+
21+
<waitForElementVisible selector="{{StorefrontCategorySidebarSection.filterOptionsTitle(attributeLabel)}}" stepKey="waitForAttributeVisible"/>
22+
<conditionalClick selector="{{StorefrontCategorySidebarSection.filterOptionsTitle(attributeLabel)}}" dependentSelector="{{StorefrontCategorySidebarSection.activeFilterOptions}}" visible="false" stepKey="clickToExpandAttribute"/>
23+
<waitForElementVisible selector="{{StorefrontCategorySidebarSection.activeFilterOptions}}" stepKey="waitForAttributeOptionsVisible"/>
24+
<see selector="{{StorefrontCategorySidebarSection.activeFilterOptionItemByPosition(attributeOptionPosition)}}" userInput="{{attributeOptionLabel}}" stepKey="assertAttributeOptionInLayeredNavigation"/>
25+
</actionGroup>
26+
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/Section/StorefrontCategorySidebarSection.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515
<element name="optionQty" type="text" selector=".filter-options-content .item .count"/>
1616
<element name="filterOptionByLabel" type="button" selector=" div.filter-options-item div[option-label='{{optionLabel}}']" parameterized="true"/>
1717
<element name="removeFilter" type="button" selector="div.filter-current .remove"/>
18+
<element name="activeFilterOptions" type="text" selector=".filter-options-item.active .items"/>
19+
<element name="activeFilterOptionItemByPosition" type="text" selector=".filter-options-item.active .items li:nth-child({{itemPosition}}) a" parameterized="true"/>
1820
</section>
1921
<section name="StorefrontCategorySidebarMobileSection">
2022
<element name="shopByButton" type="button" selector="//div[contains(@class, 'filter-title')]/strong[contains(text(), 'Shop By')]"/>
2123
</section>
22-
</sections>
24+
</sections>
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="AdminCheckCustomAttributeValuesAfterProductSaveTest">
11+
<annotations>
12+
<features value="Catalog"/>
13+
<stories value="Product attributes"/>
14+
<title value="Saving custom attribute values using UI"/>
15+
<description value="Checks that saved custom attribute values are reflected on the product's edit page"/>
16+
<severity value="MAJOR"/>
17+
<testCaseId value="MC-29653"/>
18+
<useCaseId value="MC-29023"/>
19+
<group value="catalog"/>
20+
</annotations>
21+
<before>
22+
<!-- Create multi select product attribute -->
23+
<createData entity="productAttributeMultiselectTwoOptions" stepKey="createMultiSelectProductAttribute"/>
24+
<!-- Add options to created product attribute -->
25+
<createData entity="productAttributeOption1" stepKey="addFirstOptionToAttribute">
26+
<requiredEntity createDataKey="createMultiSelectProductAttribute"/>
27+
</createData>
28+
<createData entity="productAttributeOption2" stepKey="addSecondOptionToAttribute">
29+
<requiredEntity createDataKey="createMultiSelectProductAttribute"/>
30+
</createData>
31+
<createData entity="productAttributeOption3" stepKey="addThirdOptionToAttribute">
32+
<requiredEntity createDataKey="createMultiSelectProductAttribute"/>
33+
</createData>
34+
<!-- Create simple product -->
35+
<createData entity="SimpleProduct2" stepKey="createSimpleProduct"/>
36+
<magentoCLI command="indexer:reindex" arguments="catalogsearch_fulltext" stepKey="reindexCatalogSearch"/>
37+
<!-- Login to Admin page -->
38+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
39+
</before>
40+
<after>
41+
<!-- Delete created entities -->
42+
<deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/>
43+
<deleteData createDataKey="createMultiSelectProductAttribute" stepKey="deleteMultiSelectProductAttribute"/>
44+
<!-- Logout from Admin page -->
45+
<actionGroup ref="logout" stepKey="logoutFromAdmin"/>
46+
</after>
47+
48+
<!-- Open created product for edit -->
49+
<amOnPage url="{{AdminProductEditPage.url($createSimpleProduct.id$)}}" stepKey="goToProductEditPage"/>
50+
<waitForPageLoad stepKey="waitForProductPageLoad"/>
51+
52+
<!-- Add created attribute to the product -->
53+
<actionGroup ref="AddProductAttributeInProductModalActionGroup" stepKey="addAttributeToProduct">
54+
<argument name="attributeCode" value="$createMultiSelectProductAttribute.attribute_code$"/>
55+
</actionGroup>
56+
<waitForPageLoad stepKey="waitForAttributeAdded"/>
57+
58+
<!-- Expand 'Attributes' tab -->
59+
<actionGroup ref="AdminExpandProductAttributesTabActionGroup" stepKey="expandAttributesTab"/>
60+
<!-- Check created attribute presents in the 'Attributes' tab -->
61+
<seeElement selector="{{AdminProductAttributesSection.attributeDropdownByCode($createMultiSelectProductAttribute.attribute_code$)}}" stepKey="assertAttributeIsPresentInTab"/>
62+
<!-- Select attribute options -->
63+
<selectOption selector="{{AdminProductAttributesSection.attributeDropdownByCode($createMultiSelectProductAttribute.attribute_code$)}}" parameterArray="[$addFirstOptionToAttribute.option[store_labels][0][label]$, $addThirdOptionToAttribute.option[store_labels][0][label]$]" stepKey="selectAttributeOptions"/>
64+
<!-- Save product -->
65+
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductForm"/>
66+
67+
<!-- Check attribute options are selected -->
68+
<actionGroup ref="AdminExpandProductAttributesTabActionGroup" stepKey="expandAttributesTabAfterProductSave"/>
69+
<seeOptionIsSelected selector="{{AdminProductAttributesSection.attributeDropdownByCode($createMultiSelectProductAttribute.attribute_code$)}}" userInput="$addFirstOptionToAttribute.option[store_labels][0][label]$" stepKey="assertFirstOptionIsSelected"/>
70+
<seeOptionIsSelected selector="{{AdminProductAttributesSection.attributeDropdownByCode($createMultiSelectProductAttribute.attribute_code$)}}" userInput="$addThirdOptionToAttribute.option[store_labels][0][label]$" stepKey="assertThirdOptionIsSelected"/>
71+
72+
<!-- Search for the product on Storefront -->
73+
<amOnPage url="{{StorefrontHomePage.url}}" stepKey="goToHomePage"/>
74+
<waitForPageLoad stepKey="waitForHomePageLoad"/>
75+
<actionGroup ref="StorefrontCheckQuickSearchActionGroup" stepKey="searchProductOnStorefront">
76+
<argument name="phrase" value="$createSimpleProduct.name$"/>
77+
</actionGroup>
78+
79+
<!-- Assert that attribute values present in layered navigation -->
80+
<actionGroup ref="AssertStorefrontAttributeOptionPresentInLayeredNavigationActionGroup" stepKey="assertFirstAttributeOptionPresence">
81+
<argument name="attributeLabel" value="$createMultiSelectProductAttribute.attribute[frontend_labels][0][label]$"/>
82+
<argument name="attributeOptionLabel" value="$addFirstOptionToAttribute.option[store_labels][0][label]$"/>
83+
<argument name="attributeOptionPosition" value="1"/>
84+
</actionGroup>
85+
<actionGroup ref="AssertStorefrontAttributeOptionPresentInLayeredNavigationActionGroup" stepKey="assertThirdAttributeOptionPresence">
86+
<argument name="attributeLabel" value="$createMultiSelectProductAttribute.attribute[frontend_labels][0][label]$"/>
87+
<argument name="attributeOptionLabel" value="$addThirdOptionToAttribute.option[store_labels][0][label]$"/>
88+
<argument name="attributeOptionPosition" value="2"/>
89+
</actionGroup>
90+
</test>
91+
</tests>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
<actionGroup ref="logout" stepKey="adminLogout"/>
5252
</after>
5353

54-
<actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/>
54+
<comment userInput="remove me" stepKey="disableWYSIWYG"/>
5555

5656
<!-- Create new virtual product -->
5757
<actionGroup ref="GoToSpecifiedCreateProductPageActionGroup" stepKey="createVirtualProduct">
@@ -185,6 +185,6 @@
185185
<actionGroup ref="StorefrontOpenCartFromMinicartActionGroup" stepKey="openCart"/>
186186
<dontSeeElement selector="{{StorefrontProductCartGiftOptionSection.giftOptions}}" stepKey="dontSeeGiftOptionBtn"/>
187187

188-
<actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/>
188+
<comment userInput="remove me" stepKey="enableWYSIWYG"/>
189189
</test>
190190
</tests>

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
<testCaseId value="MC-14714"/>
1616
<severity value="CRITICAL"/>
1717
<group value="mtf_migrated"/>
18+
<skip>
19+
<issueId value="MC-30409"/>
20+
</skip>
1821
</annotations>
1922

2023
<before>

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@
1818
<testCaseId value="MAGETWO-58718"/>
1919
<group value="product"/>
2020
<group value="WYSIWYGDisabled"/>
21-
<skip>
22-
<issueId value="MC-13841"/>
23-
</skip>
2421
</annotations>
2522
<before>
2623
<!-- Login Admin -->

app/code/Magento/CatalogRule/Test/Mftf/Test/StorefrontInactiveCatalogRuleTest.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
<severity value="CRITICAL"/>
1818
<testCaseId value="MC-79"/>
1919
<group value="CatalogRule"/>
20+
<skip>
21+
<issueId value="MC-30384"/>
22+
</skip>
2023
</annotations>
2124
<before>
2225
<actionGroup ref="LoginAsAdmin" stepKey="login"/>

app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
<severity value="CRITICAL"/>
1818
<testCaseId value="MC-5922"/>
1919
<group value="checkout"/>
20+
<skip>
21+
<issueId value="MC-30111"/>
22+
</skip>
2023
</annotations>
2124
<before>
2225
<createData entity="SimpleSubCategory" stepKey="simplecategory"/>

app/code/Magento/Cms/Test/Mftf/Test/AdminAddImageToWYSIWYGCMSTest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
<seeElement selector="{{StorefrontCMSPageSection.mediaDescription}}" stepKey="assertMediaDescription"/>
5656
<seeElementInDOM selector="{{StorefrontCMSPageSection.imageSource(ImageUpload3.fileName)}}" stepKey="assertMediaSource"/>
5757
<after>
58+
<actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYGFirst"/>
5859
<deleteData createDataKey="createCMSPage" stepKey="deletePreReqCMSPage" />
5960
<actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/>
6061
<actionGroup ref="logout" stepKey="logout"/>

app/code/Magento/DownloadableGraphQl/Model/ResourceModel/GetPurchasedDownloadableProducts.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ public function execute(int $customerId): array
3939
{
4040
$connection = $this->resourceConnection->getConnection();
4141
$allowedItemsStatuses = [Item::LINK_STATUS_PENDING_PAYMENT, Item::LINK_STATUS_PAYMENT_REVIEW];
42-
$downloadablePurchasedTable = $connection->getTableName('downloadable_link_purchased');
42+
$downloadablePurchasedTable = $this->resourceConnection->getTableName('downloadable_link_purchased');
4343

4444
/* The fields names are hardcoded since there's no existing name reference in the code */
4545
$selectQuery = $connection->select()
4646
->from($downloadablePurchasedTable)
4747
->joinLeft(
48-
['item' => $connection->getTableName('downloadable_link_purchased_item')],
48+
['item' => $this->resourceConnection->getTableName('downloadable_link_purchased_item')],
4949
"$downloadablePurchasedTable.purchased_id = item.purchased_id"
5050
)
5151
->where("$downloadablePurchasedTable.customer_id = ?", $customerId)

0 commit comments

Comments
 (0)