Skip to content

Commit 3e4c362

Browse files
author
hwyu@adobe.com
committed
Merge remote-tracking branch 'upstream/2.4.3-develop' into MC-40096-2
2 parents 519e8d5 + ba65daf commit 3e4c362

File tree

37 files changed

+1074
-144
lines changed

37 files changed

+1074
-144
lines changed

app/code/Magento/Catalog/Model/Api/SearchCriteria/CollectionProcessor/ConditionProcessor/ConditionBuilder/EavAttributeCondition.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@ public function build(Filter $filter): string
6464
->select()
6565
->from(
6666
[Collection::MAIN_TABLE_ALIAS => $entityResourceModel->getEntityTable()],
67-
Collection::MAIN_TABLE_ALIAS . '.' . $entityResourceModel->getEntityIdField()
67+
Collection::MAIN_TABLE_ALIAS . '.' . $attribute->getEntityIdField()
6868
)->joinLeft(
6969
[$tableAlias => $attribute->getBackendTable()],
7070
$tableAlias . '.' . $attribute->getEntityIdField() . '=' . Collection::MAIN_TABLE_ALIAS .
71-
'.' . $entityResourceModel->getEntityIdField() . ' AND ' . $tableAlias . '.' .
71+
'.' . $attribute->getEntityIdField() . ' AND ' . $tableAlias . '.' .
7272
$attribute->getIdFieldName() . '=' . $attribute->getAttributeId(),
7373
''
7474
)->where($tableAlias . '.value is null');
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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="StorefrontAssertRelatedProductOnProductPageActionGroup">
12+
<annotations>
13+
<description>Validates that the provided Product Name is present on Product details page.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="productName" type="string" defaultValue="{{_defaultProduct.name}}"/>
17+
</arguments>
18+
19+
<waitForElementVisible selector="{{StorefrontProductRelatedProductsSection.relatedProductsListSectionText}}" stepKey="waitForRelatedProductsList"/>
20+
<see selector="{{StorefrontProductRelatedProductsSection.relatedProductsListSectionText}}" userInput="{{productName}}" stepKey="seeRelatedProduct"/>
21+
</actionGroup>
22+
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/Test/AdvanceCatalogSearchSimpleProductTest/AdvanceCatalogSearchSimpleProductByShortDescriptionTest.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
<group value="Catalog"/>
1919
</annotations>
2020
<before>
21+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
22+
<actionGroup ref="DeleteAllProductsUsingProductGridActionGroup" stepKey="deleteAllProducts"/>
2123
<createData entity="ApiProductWithDescription" stepKey="product"/>
2224
</before>
2325
<after>

app/code/Magento/Catalog/Test/Unit/Model/Product/Type/PriceTest.php

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
use Magento\Store\Model\StoreManagerInterface;
2222
use Magento\Store\Model\Website;
2323
use PHPUnit\Framework\MockObject\MockObject;
24+
use PHPUnit\Framework\MockObject\RuntimeException;
2425
use PHPUnit\Framework\TestCase;
2526

2627
/**
@@ -110,7 +111,7 @@ protected function setUp(): void
110111
$this->groupManagementMock->expects($this->any())->method('getAllCustomersGroup')
111112
->willReturn($group);
112113
$this->tierPriceExtensionFactoryMock = $this->getMockBuilder(ProductTierPriceExtensionFactory::class)
113-
->setMethods(['create'])
114+
->onlyMethods(['create'])
114115
->disableOriginalConstructor()
115116
->getMock();
116117
$this->model = $this->objectManagerHelper->getObject(
@@ -182,9 +183,7 @@ function () {
182183
);
183184

184185
// create sample TierPrice objects that would be coming from a REST call
185-
$tierPriceExtensionMock = $this->getMockBuilder(ProductTierPriceExtensionInterface::class)
186-
->setMethods(['getWebsiteId', 'setWebsiteId', 'getPercentageValue', 'setPercentageValue'])
187-
->getMockForAbstractClass();
186+
$tierPriceExtensionMock = $this->getProductTierPriceExtensionInterfaceMock();
188187
$tierPriceExtensionMock->expects($this->any())->method('getWebsiteId')->willReturn($expectedWebsiteId);
189188
$tierPriceExtensionMock->expects($this->any())->method('getPercentageValue')->willReturn(null);
190189
$tp1 = $this->objectManagerHelper->getObject(TierPrice::class);
@@ -226,9 +225,7 @@ function () {
226225
$this->assertEquals($tps[$i]->getQty(), $tpData['price_qty'], 'Qty does not match');
227226
}
228227

229-
$tierPriceExtensionMock = $this->getMockBuilder(ProductTierPriceExtensionInterface::class)
230-
->setMethods(['getWebsiteId', 'setWebsiteId', 'getPercentageValue', 'setPercentageValue'])
231-
->getMockForAbstractClass();
228+
$tierPriceExtensionMock = $this->getProductTierPriceExtensionInterfaceMock();
232229
$tierPriceExtensionMock->expects($this->any())->method('getPercentageValue')->willReturn(50);
233230
$tierPriceExtensionMock->expects($this->any())->method('setWebsiteId');
234231
$this->tierPriceExtensionFactoryMock->expects($this->any())
@@ -289,14 +286,30 @@ function () {
289286
return $this->objectManagerHelper->getObject(TierPrice::class);
290287
}
291288
);
292-
$tierPriceExtensionMock = $this->getMockBuilder(ProductTierPriceExtensionInterface::class)
293-
->onlyMethods(['getPercentageValue', 'setPercentageValue'])
294-
->getMockForAbstractClass();
289+
$tierPriceExtensionMock = $this->getProductTierPriceExtensionInterfaceMock();
295290
$tierPriceExtensionMock->method('getPercentageValue')
296291
->willReturn(50);
297292
$this->tierPriceExtensionFactoryMock->method('create')
298293
->willReturn($tierPriceExtensionMock);
299294

300295
$this->assertInstanceOf(TierPrice::class, $this->model->getTierPrices($this->product)[0]);
301296
}
297+
298+
/**
299+
* Build ProductTierPriceExtensionInterface mock.
300+
*
301+
* @return MockObject
302+
*/
303+
private function getProductTierPriceExtensionInterfaceMock(): MockObject
304+
{
305+
$mockBuilder = $this->getMockBuilder(ProductTierPriceExtensionInterface::class)
306+
->disableOriginalConstructor();
307+
try {
308+
$mockBuilder->addMethods(['getPercentageValue', 'setPercentageValue', 'setWebsiteId', 'getWebsiteId']);
309+
} catch (RuntimeException $e) {
310+
// ProductTierPriceExtensionInterface already generated and has all necessary methods.
311+
}
312+
313+
return $mockBuilder->getMock();
314+
}
302315
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
<requiredEntity createDataKey="createSimpleProduct"/>
4040
</createData>
4141
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
42-
<argument name="indices" value="cataloginventory_stock"/>
42+
<argument name="indices" value=""/>
4343
</actionGroup>
4444
</before>
4545
<after>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
<requiredEntity createDataKey="createSimpleProduct"/>
3838
</createData>
3939
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
40-
<argument name="indices" value="cataloginventory_stock"/>
40+
<argument name="indices" value=""/>
4141
</actionGroup>
4242
<actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache">
4343
<argument name="tags" value=""/>

app/code/Magento/Csp/Helper/InlineUtil.php

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
namespace Magento\Csp\Helper;
1010

1111
use Magento\Csp\Api\InlineUtilInterface;
12+
use Magento\Csp\Model\Collector\ConfigCollector;
1213
use Magento\Csp\Model\Collector\DynamicCollector;
1314
use Magento\Csp\Model\Policy\FetchPolicy;
1415
use Magento\Framework\App\ObjectManager;
@@ -39,6 +40,11 @@ class InlineUtil implements InlineUtilInterface, SecurityProcessorInterface
3940
*/
4041
private $htmlRenderer;
4142

43+
/**
44+
* @var ConfigCollector
45+
*/
46+
private $configCollector;
47+
4248
private static $tagMeta = [
4349
'script' => ['id' => 'script-src', 'remote' => ['src'], 'hash' => true],
4450
'style' => ['id' => 'style-src', 'remote' => [], 'hash' => true],
@@ -60,15 +66,18 @@ class InlineUtil implements InlineUtilInterface, SecurityProcessorInterface
6066
* @param DynamicCollector $dynamicCollector
6167
* @param bool $useUnsafeHashes Use 'unsafe-hashes' policy (not supported by CSP v2).
6268
* @param HtmlRenderer|null $htmlRenderer
69+
* @param ConfigCollector|null $configCollector
6370
*/
6471
public function __construct(
6572
DynamicCollector $dynamicCollector,
6673
bool $useUnsafeHashes = false,
67-
?HtmlRenderer $htmlRenderer = null
74+
?HtmlRenderer $htmlRenderer = null,
75+
?ConfigCollector $configCollector = null
6876
) {
6977
$this->dynamicCollector = $dynamicCollector;
7078
$this->useUnsafeHashes = $useUnsafeHashes;
7179
$this->htmlRenderer = $htmlRenderer ?? ObjectManager::getInstance()->get(HtmlRenderer::class);
80+
$this->configCollector = $configCollector ?? ObjectManager::getInstance()->get(ConfigCollector::class);
7281
}
7382

7483
/**
@@ -187,7 +196,10 @@ public function processTag(TagData $tagData): TagData
187196
new FetchPolicy($policyId, false, $remotes)
188197
);
189198
}
190-
if ($tagData->getContent() && !empty(self::$tagMeta[$tagData->getTag()]['hash'])) {
199+
if ($tagData->getContent()
200+
&& !empty(self::$tagMeta[$tagData->getTag()]['hash'])
201+
&& $this->isInlineDisabled(self::$tagMeta[$tagData->getTag()]['id'])
202+
) {
191203
$this->dynamicCollector->add(
192204
new FetchPolicy(
193205
$policyId,
@@ -233,4 +245,21 @@ public function processEventHandler(EventHandlerData $eventHandlerData): EventHa
233245

234246
return $eventHandlerData;
235247
}
248+
249+
/**
250+
* Check if inline sources are prohibited.
251+
*
252+
* @param string $policyId
253+
* @return bool
254+
*/
255+
private function isInlineDisabled(string $policyId): bool
256+
{
257+
foreach ($this->configCollector->collect() as $policy) {
258+
if ($policy->getId() === $policyId && $policy instanceof FetchPolicy) {
259+
return !$policy->isInlineAllowed();
260+
}
261+
}
262+
263+
return false;
264+
}
236265
}

app/code/Magento/Customer/Test/Mftf/Data/AddressData.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,9 @@
198198
</array>
199199
<data key="state">California</data>
200200
</entity>
201+
<entity name="US_With_Vat_Number" type="address" extends="US_Address_CA">
202+
<data key="vat_id">U1234567891</data>
203+
</entity>
201204
<entity name="US_Default_Billing_Address_TX" type="address" extends="US_Address_TX">
202205
<data key="default_billing">false</data>
203206
<data key="default_shipping">true</data>

app/code/Magento/Customer/Test/Mftf/Data/CustomerData.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,9 @@
233233
<data key="website_id">0</data>
234234
<requiredEntity type="address">UK_Not_Default_Address</requiredEntity>
235235
</entity>
236+
<entity name="Customer_With_Vat_Number" type="customer" extends="Simple_Customer_Without_Address">
237+
<requiredEntity type="address">US_With_Vat_Number</requiredEntity>
238+
</entity>
236239
<entity name="Customer_With_Different_Default_Billing_Shipping_Addresses" type="customer">
237240
<data key="group_id">1</data>
238241
<data key="email" unique="prefix">John.Doe@example.com</data>

app/code/Magento/Downloadable/view/frontend/web/js/downloadable.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,19 @@ define([
1717
*/
1818
$.widget('mage.downloadable', {
1919
options: {
20-
priceHolderSelector: '.price-box'
20+
priceHolderSelector: '.price-box',
21+
linkElement: '',
22+
allElements: ''
23+
},
24+
25+
/**
26+
* @inheritdoc
27+
*/
28+
_init: function initLinks() {
29+
var element = this.element,
30+
options = $(this.options.linkElement, element);
31+
32+
options.trigger('change');
2133
},
2234

2335
/**

0 commit comments

Comments
 (0)