Skip to content

Commit 333f81c

Browse files
committed
Merge branch '2.4-develop' of https://github.com/adobe-commerce-tier-4/magento2ce into ACP2E-3171
2 parents 1d47b7a + c3ab314 commit 333f81c

File tree

60 files changed

+1881
-107
lines changed

Some content is hidden

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

60 files changed

+1881
-107
lines changed

app/code/Magento/Backend/Test/Mftf/Section/AdminMessagesSection.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,7 @@
2323
<element name="errorMessage" type="text" selector=".message.message-error.error"/>
2424
<element name="warningMessage" type="text" selector=".message-warning"/>
2525
<element name="noticeMessage" type="text" selector=".message-notice"/>
26+
<element name="assertCacheManagementConfigurationStatus" type="button" selector="//td[@data-column='tags' and contains(text(),'CONFIG')]/following-sibling::td//span[@class='grid-severity-notice']//span"/>
27+
<element name="assertCacheManagementLayoutsStatus" type="button" selector="//td[@data-column='tags' and contains(text(),'LAYOUT_GENERAL_CACHE_TAG')]/following-sibling::td//span[@class='grid-severity-notice']//span"/>
2628
</section>
2729
</sections>

app/code/Magento/Bundle/view/adminhtml/web/js/components/bundle-dynamic-rows-grid.js

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -141,18 +141,13 @@ define([
141141
* @returns {Object} Chainable.
142142
*/
143143
initElements: function (data) {
144-
var newData = this.getNewData(data),
145-
recordIndex;
144+
var newData = this.getNewData(data);
146145

147146
this.parsePagesData(data);
148147

149148
if (newData.length) {
150149
if (this.insertData().length) {
151-
recordIndex = data.length - newData.length - 1;
152-
153-
_.each(newData, function (newRecord) {
154-
this.processingAddChild(newRecord, ++recordIndex, newRecord[this.identificationProperty]);
155-
}, this);
150+
this.parseProcessingAddChild(data, newData);
156151
}
157152
}
158153

@@ -181,6 +176,23 @@ define([
181176
this.reload();
182177
}
183178
}, this);
179+
},
180+
181+
/**
182+
* Parse and processing the add child method to update the latest records if the record index is not a number.
183+
*
184+
* @param {Array} data
185+
* @param {Array} newData
186+
*/
187+
parseProcessingAddChild: function (data, newData) {
188+
let recordIndex;
189+
190+
recordIndex = data.length - newData.length - 1;
191+
if (!isNaN(recordIndex)) {
192+
_.each(newData, function (newRecord) {
193+
this.processingAddChild(newRecord, ++recordIndex, newRecord[this.identificationProperty]);
194+
}, this);
195+
}
184196
}
185197
});
186198
});

app/code/Magento/Bundle/view/adminhtml/web/js/components/bundle-dynamic-rows.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ define([
7474
let bundleSelections = registry.get(this.name + '.' + index + '.' + this.bundleSelectionsName);
7575

7676
bundleSelections.destroyChildren();
77+
bundleSelections._elems.clear();
7778
},
7879

7980
/**
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
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="AdminValidateLayoutConfigurationTest">
11+
<annotations>
12+
<features value="Cache"/>
13+
<stories value="Cache Management"/>
14+
<title value="Validate Configuration Cache Type"/>
15+
<description value="Validate Configuration Cache Type After Cache Management"/>
16+
<severity value="CRITICAL"/>
17+
<testCaseId value="AC-4231"/>
18+
</annotations>
19+
<before>
20+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
21+
<createData entity="_defaultCategory" stepKey="createPreReqCategory"/>
22+
<createData entity="_defaultProduct" stepKey="createProduct">
23+
<requiredEntity createDataKey="createPreReqCategory"/>
24+
</createData>
25+
<actionGroup ref="AdminGoToCacheManagementPageActionGroup" stepKey="goToCacheManagementPage"/>
26+
<waitForText selector="{{AdminMessagesSection.assertCacheManagementConfigurationStatus}}" userInput="ENABLED" stepKey="verifyCacheTypeConfigurationIsENABLED"/>
27+
</before>
28+
<after>
29+
<!-- Delete category -->
30+
<deleteData createDataKey="createPreReqCategory" stepKey="deleteCategory"/>
31+
<!-- Delete product -->
32+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
33+
<!--Restore currency symbols to default-->
34+
<actionGroup ref="AdminNavigateToCurrencySymbolsPageActionGroup" stepKey="navigateToCurrencySymbolsPageToRestore"/>
35+
<checkOption selector="{{AdminCurrencySymbolsGridSection.currencyCheckBox}}" stepKey="checkConfigSettingsMessage"/>
36+
<waitForElementClickable selector="{{AdminCurrencySymbolsGridSection.saveCurrencySymbols}}" stepKey="waitForSaveCurrencySymbolAgain"/>
37+
<click selector="{{AdminCurrencySymbolsGridSection.saveCurrencySymbols}}" stepKey="clickSaveCurrencySymbolsToRestore"/>
38+
<!-- Flush Cache-->
39+
<actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanCachesAfterRevokingTheChangesToDefault">
40+
<argument name="tags" value="" />
41+
</actionGroup>
42+
<!-- Log out -->
43+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
44+
</after>
45+
<!-- Validate Storefront -->
46+
<actionGroup ref="NavigateToStorefrontForCreatedPageActionGroup" stepKey="navigateToProductStorefront">
47+
<argument name="page" value="$$createProduct.name$$.html"/>
48+
</actionGroup>
49+
<!--Assert Currency symbol-->
50+
<waitForText selector="{{AdminCurrencySymbolsGridSection.currencySymbolOfProduct}}" userInput="$" stepKey="waitForCurrencySymbolInStoreFront"/>
51+
<!-- Navigate To Currency Symbol-->
52+
<actionGroup ref="AdminNavigateToCurrencySymbolsPageActionGroup" stepKey="navigateToCurrencySymbolsPage"/>
53+
<!--Replace standard currency symbol by custom currency symbol-->
54+
<uncheckOption selector="{{AdminCurrencySymbolsGridSection.currencyCheckBox}}" stepKey="uncheckConfigSettingsMessage"/>
55+
<fillField selector="{{AdminCurrencySymbolsGridSection.inputCurrencySymbol}}" userInput="£" stepKey="fillDefaultLabel"/>
56+
<!--Save custom currency symbol-->
57+
<waitForElementClickable selector="{{AdminCurrencySymbolsGridSection.saveCurrencySymbols}}" stepKey="waitForSaveCurrencySymbol"/>
58+
<click selector="{{AdminCurrencySymbolsGridSection.saveCurrencySymbols}}" stepKey="clickSaveCurrencySymbols"/>
59+
<waitForText selector="{{AdminMessagesSection.success}}" userInput="{{AdminSaveCurrencySymbolMessageData.success}}" stepKey="seeSuccessMessage"/>
60+
<!--Navigate To Product Storefront-->
61+
<actionGroup ref="NavigateToStorefrontForCreatedPageActionGroup" stepKey="navigateToProductStorefront1">
62+
<argument name="page" value="$$createProduct.name$$.html"/>
63+
</actionGroup>
64+
<!--Assert Currency symbol is not changed-->
65+
<waitForText selector="{{AdminCurrencySymbolsGridSection.currencySymbolOfProduct}}" userInput="$" stepKey="verifyCurrencySymbolIsNotChangedBeforeFlushingTheChangesInStoreFront"/>
66+
<!--Navigate to Cache Management-->
67+
<actionGroup ref="AdminGoToCacheManagementPageActionGroup" stepKey="goToCacheManagementPage1"/>
68+
<!-- Flush Cache-->
69+
<actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanCachesAfterChangesMade">
70+
<argument name="tags" value="" />
71+
</actionGroup>
72+
<!--Navigate To Product Storefront-->
73+
<actionGroup ref="NavigateToStorefrontForCreatedPageActionGroup" stepKey="navigateToProductStorefront2">
74+
<argument name="page" value="$$createProduct.name$$.html"/>
75+
</actionGroup>
76+
<waitForText selector="{{AdminCurrencySymbolsGridSection.currencySymbolOfProduct}}" userInput="£" stepKey="verifyCurrencySymbolIsChangedAfterFlushingTheChangesInStoreFront"/>
77+
</test>
78+
</tests>
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
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="AdminValidateLayoutsCacheTypeTest">
11+
<annotations>
12+
<features value="Cache"/>
13+
<stories value="Cache Management"/>
14+
<title value="Validate layouts Cache Type"/>
15+
<description value="Validate layouts Cache Type After Cache Management"/>
16+
<severity value="CRITICAL"/>
17+
<testCaseId value="AC-4221"/>
18+
</annotations>
19+
<before>
20+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
21+
<createData entity="_defaultCategory" stepKey="createPreReqCategory"/>
22+
<createData entity="_defaultProduct" stepKey="createProduct">
23+
<requiredEntity createDataKey="createPreReqCategory"/>
24+
</createData>
25+
</before>
26+
<after>
27+
<!-- Delete category -->
28+
<deleteData createDataKey="createPreReqCategory" stepKey="deleteCategory"/>
29+
<!-- Delete product -->
30+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
31+
<!--Restore currency symbols to default-->
32+
<actionGroup ref="AdminNavigateToCurrencySymbolsPageActionGroup" stepKey="navigateToCurrencySymbolsPageToRestore"/>
33+
<checkOption selector="{{AdminCurrencySymbolsGridSection.currencyCheckBox}}" stepKey="checkConfigSettingsMessage"/>
34+
<waitForElementClickable selector="{{AdminCurrencySymbolsGridSection.saveCurrencySymbols}}" stepKey="waitForSaveCurrencySymbolAgain"/>
35+
<click selector="{{AdminCurrencySymbolsGridSection.saveCurrencySymbols}}" stepKey="clickSaveCurrencySymbolsToRestore"/>
36+
<!-- Flush Cache-->
37+
<actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanCachesAfterRevokingTheChangesToDefault">
38+
<argument name="tags" value="" />
39+
</actionGroup>
40+
<!-- Log out -->
41+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
42+
</after>
43+
<!-- Validate Storefront -->
44+
<actionGroup ref="NavigateToStorefrontForCreatedPageActionGroup" stepKey="navigateToProductStorefront">
45+
<argument name="page" value="$$createProduct.name$$.html"/>
46+
</actionGroup>
47+
<!--Assert Currency symbol-->
48+
<waitForText selector="{{AdminCurrencySymbolsGridSection.currencySymbolOfProduct}}" userInput="$" stepKey="waitForCurrencySymbolInStoreFront"/>
49+
<!-- Navigate To Currency Symbol-->
50+
<actionGroup ref="AdminNavigateToCurrencySymbolsPageActionGroup" stepKey="navigateToCurrencySymbolsPage"/>
51+
<!--Replace standard currency symbol by custom currency symbol-->
52+
<uncheckOption selector="{{AdminCurrencySymbolsGridSection.currencyCheckBox}}" stepKey="uncheckConfigSettingsMessage"/>
53+
<fillField selector="{{AdminCurrencySymbolsGridSection.inputCurrencySymbol}}" userInput="£" stepKey="fillDefaultLabel"/>
54+
<!--Save custom currency symbol-->
55+
<waitForElementClickable selector="{{AdminCurrencySymbolsGridSection.saveCurrencySymbols}}" stepKey="waitForSaveCurrencySymbol"/>
56+
<click selector="{{AdminCurrencySymbolsGridSection.saveCurrencySymbols}}" stepKey="clickSaveCurrencySymbols"/>
57+
<waitForText selector="{{AdminMessagesSection.success}}" userInput="{{AdminSaveCurrencySymbolMessageData.success}}" stepKey="seeSuccessMessage"/>
58+
<!--Navigate To Product Storefront-->
59+
<actionGroup ref="NavigateToStorefrontForCreatedPageActionGroup" stepKey="navigateToProductStorefront1">
60+
<argument name="page" value="$$createProduct.name$$.html"/>
61+
</actionGroup>
62+
<!--Assert Currency symbol is not changed-->
63+
<waitForText selector="{{AdminCurrencySymbolsGridSection.currencySymbolOfProduct}}" userInput="$" stepKey="verifyCurrencySymbolIsNotChangedBeforeFlushingTheChangesInStoreFront"/>
64+
<!-- Flush Cache-->
65+
<actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanCachesAfterChangesMade">
66+
<argument name="tags" value="" />
67+
</actionGroup>
68+
<!--Navigate To Product Storefront-->
69+
<actionGroup ref="NavigateToStorefrontForCreatedPageActionGroup" stepKey="navigateToProductStorefront2">
70+
<argument name="page" value="$$createProduct.name$$.html"/>
71+
</actionGroup>
72+
<waitForText selector="{{AdminCurrencySymbolsGridSection.currencySymbolOfProduct}}" userInput="£" stepKey="verifyCurrencySymbolIsChangedAfterFlushingTheChangesInStoreFront"/>
73+
</test>
74+
</tests>

app/code/Magento/Catalog/Model/View/Asset/Placeholder.php

Lines changed: 65 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,15 @@
77
namespace Magento\Catalog\Model\View\Asset;
88

99
use Magento\Framework\App\Config\ScopeConfigInterface;
10+
use Magento\Framework\App\Filesystem\DirectoryList;
11+
use Magento\Framework\App\ObjectManager;
12+
use Magento\Framework\Filesystem;
13+
use Magento\Framework\Filesystem\DriverPool;
1014
use Magento\Framework\View\Asset\ContextInterface;
1115
use Magento\Framework\View\Asset\File\NotFoundException;
1216
use Magento\Framework\View\Asset\LocalInterface;
1317
use Magento\Framework\View\Asset\Repository;
18+
use Magento\Catalog\Model\Product\Media\ConfigInterface;
1419

1520
/**
1621
* A locally available image placeholder file asset that can be referred with a file type
@@ -53,28 +58,49 @@ class Placeholder implements LocalInterface
5358
*/
5459
private $scopeConfig;
5560

61+
/**
62+
* @var \Magento\Framework\Filesystem\Directory\WriteInterface
63+
*/
64+
private $directoryMedia;
65+
66+
/**
67+
* @var ConfigInterface
68+
*/
69+
private $mediaConfig;
70+
5671
/**
5772
* Placeholder constructor.
5873
*
5974
* @param ContextInterface $context
6075
* @param ScopeConfigInterface $scopeConfig
6176
* @param Repository $assetRepo
6277
* @param string $type
78+
* @param Filesystem|null $filesystem
79+
* @param ConfigInterface|null $mediaConfig
80+
*
6381
*/
6482
public function __construct(
6583
ContextInterface $context,
6684
ScopeConfigInterface $scopeConfig,
6785
Repository $assetRepo,
68-
$type
86+
$type,
87+
?Filesystem $filesystem = null,
88+
?ConfigInterface $mediaConfig = null
6989
) {
7090
$this->context = $context;
7191
$this->scopeConfig = $scopeConfig;
7292
$this->assetRepo = $assetRepo;
7393
$this->type = $type;
94+
$filesystem = $filesystem ?? ObjectManager::getInstance()->get(Filesystem::class);
95+
$this->mediaConfig = $mediaConfig ?? ObjectManager::getInstance()->get(ConfigInterface::class);
96+
$this->directoryMedia = $filesystem->getDirectoryWrite(
97+
DirectoryList::MEDIA,
98+
DriverPool::FILE
99+
);
74100
}
75101

76102
/**
77-
* {@inheritdoc}
103+
* @inheritdoc
78104
*/
79105
public function getUrl()
80106
{
@@ -88,20 +114,20 @@ public function getUrl()
88114
}
89115

90116
/**
91-
* {@inheritdoc}
117+
* @inheritdoc
92118
*/
93119
public function getContentType()
94120
{
95121
return $this->contentType;
96122
}
97123

98124
/**
99-
* {@inheritdoc}
125+
* @inheritdoc
100126
*/
101127
public function getPath()
102128
{
103129
if ($this->getFilePath() !== null) {
104-
$result = $this->getContext()->getPath()
130+
$result = $this->getLocalMediaPath()
105131
. DIRECTORY_SEPARATOR . $this->getModule()
106132
. DIRECTORY_SEPARATOR . $this->getFilePath();
107133
} else {
@@ -119,7 +145,35 @@ public function getPath()
119145
}
120146

121147
/**
122-
* {@inheritdoc}
148+
* Get path for local media
149+
*
150+
* @return string
151+
*/
152+
private function getLocalMediaPath()
153+
{
154+
return $this->directoryMedia->getAbsolutePath($this->mediaConfig->getBaseMediaPath());
155+
}
156+
157+
/**
158+
* Get relative placeholder path
159+
*
160+
* @return string|null
161+
*/
162+
public function getRelativePath()
163+
{
164+
$result = null;
165+
//will use system placeholder unless another specified in the config
166+
if ($this->getFilePath() !== null) {
167+
$result = DIRECTORY_SEPARATOR . DirectoryList::MEDIA
168+
. DIRECTORY_SEPARATOR . $this->directoryMedia->getRelativePath($this->mediaConfig->getBaseMediaPath())
169+
. DIRECTORY_SEPARATOR . $this->getModule()
170+
. DIRECTORY_SEPARATOR . $this->getFilePath();
171+
}
172+
return $result;
173+
}
174+
175+
/**
176+
* @inheritdoc
123177
*/
124178
public function getSourceFile()
125179
{
@@ -137,15 +191,15 @@ public function getSourceContentType()
137191
}
138192

139193
/**
140-
* {@inheritdoc}
194+
* @inheritdoc
141195
*/
142196
public function getContent()
143197
{
144198
return null;
145199
}
146200

147201
/**
148-
* {@inheritdoc}
202+
* @inheritdoc
149203
*/
150204
public function getFilePath()
151205
{
@@ -163,7 +217,8 @@ public function getFilePath()
163217
}
164218

165219
/**
166-
* {@inheritdoc}
220+
* @inheritdoc
221+
*
167222
* @return ContextInterface
168223
*/
169224
public function getContext()
@@ -172,7 +227,7 @@ public function getContext()
172227
}
173228

174229
/**
175-
* {@inheritdoc}
230+
* @inheritdoc
176231
*/
177232
public function getModule()
178233
{

app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1538,4 +1538,14 @@
15381538
<requiredEntity type="product_option">ProductOptionCheckboxFor2</requiredEntity>
15391539
<requiredEntity type="product_option">ProductOptionNewField</requiredEntity>
15401540
</entity>
1541+
<entity name="SimpleProductWithQty1" type="product" extends="_defaultProduct">
1542+
<data key="name" unique="suffix">Simple Product 3</data>
1543+
<data key="price">1.00</data>
1544+
<data key="urlKey" unique="suffix">Simple Product 3</data>
1545+
<data key="status">1</data>
1546+
<data key="quantity">1</data>
1547+
<data key="weight">1</data>
1548+
<requiredEntity type="product_extension_attribute">EavStock1</requiredEntity>
1549+
<requiredEntity type="custom_attribute_array">CustomAttributeCategoryIds</requiredEntity>
1550+
</entity>
15411551
</entities>

0 commit comments

Comments
 (0)