Skip to content

Commit 428d32d

Browse files
committed
Merge remote-tracking branch 'commerce/2.4-develop' into platform-health
2 parents 5c9a777 + ab815b5 commit 428d32d

File tree

71 files changed

+1547
-124
lines changed

Some content is hidden

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

71 files changed

+1547
-124
lines changed

app/code/Magento/AwsS3/Driver/AwsS3Factory.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@ public function createConfigured(
116116
$config['http_handler'] = $this->objectManager->create($config['http_handler'])($config);
117117
}
118118

119+
if (!empty($config['path_style'])) {
120+
$config['use_path_style_endpoint'] = boolval($config['path_style']);
121+
}
122+
119123
$client = new S3Client($config);
120124
$adapter = new AwsS3V3Adapter($client, $config['bucket'], $prefix);
121125
$cache = $this->cacheInterfaceFactory->create(

app/code/Magento/AwsS3/Model/Config.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@
1414
*/
1515
class Config
1616
{
17+
public const PATH_ENDPOINT = 'remote_storage/endpoint';
1718
public const PATH_REGION = 'remote_storage/region';
1819
public const PATH_BUCKET = 'remote_storage/bucket';
1920
public const PATH_ACCESS_KEY = 'remote_storage/access_key';
2021
public const PATH_SECRET_KEY = 'remote_storage/secret_key';
2122
public const PATH_PREFIX = 'remote_storage/prefix';
23+
public const PATH_PATH_STYLE = 'remote_storage/path_style';
2224

2325
/**
2426
* @var DeploymentConfig
@@ -33,6 +35,16 @@ public function __construct(DeploymentConfig $config)
3335
$this->config = $config;
3436
}
3537

38+
/**
39+
* Retrieves endpoint.
40+
*
41+
* @return string
42+
*/
43+
public function getEndpoint(): string
44+
{
45+
return (string)$this->config->get(self::PATH_ENDPOINT);
46+
}
47+
3648
/**
3749
* Retrieves region.
3850
*
@@ -82,4 +94,14 @@ public function getPrefix(): string
8294
{
8395
return (string)$this->config->get(self::PATH_PREFIX, '');
8496
}
97+
98+
/**
99+
* Retrieves endpoint.
100+
*
101+
* @return string
102+
*/
103+
public function getPathStyle(): string
104+
{
105+
return (string)$this->config->get(self::PATH_PATH_STYLE, '0');
106+
}
85107
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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="AssertStorefrontBreadcrubmsAreShownActionGroup">
12+
<arguments>
13+
<argument name="breadcrumbs" type="string"/>
14+
</arguments>
15+
<see selector="{{StorefrontNavigationSection.breadcrumbs}}" userInput="{{breadcrumbs}}" stepKey="seeBreadcrumbsOnPage"/>
16+
</actionGroup>
17+
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/Test/StorefrontProductNameWithDoubleQuoteTest/StorefrontProductNameWithHTMLEntitiesTest.xml

Lines changed: 46 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -36,37 +36,63 @@
3636
<comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/>
3737

3838
<!--Check product in category listing-->
39-
<amOnPage url="{{StorefrontCategoryPage.url($$createCategoryOne.custom_attributes[url_key]$$)}}" stepKey="navigateToCategoryPage"/>
40-
<waitForPageLoad stepKey="waitforCategoryPageToLoad"/>
41-
<see selector="{{StorefrontCategoryProductSection.ProductTitleByName(productWithHTMLEntityOne.name)}}" userInput="{{productWithHTMLEntityOne.name}}" stepKey="seeCorrectNameProd1CategoryPage"/>
42-
<see selector="{{StorefrontCategoryProductSection.ProductTitleByName(productWithHTMLEntityTwo.name)}}" userInput="{{productWithHTMLEntityTwo.name}}" stepKey="seeCorrectNameProd2CategoryPage"/>
39+
<actionGroup ref="StorefrontNavigateCategoryPageActionGroup" stepKey="navigateToCategoryPage">
40+
<argument name="category" value="$$createCategoryOne$$"/>
41+
</actionGroup>
42+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitforCategoryPageToLoad"/>
43+
<actionGroup ref="AssertStorefrontProductIsPresentOnCategoryPageActionGroup" stepKey="seeCorrectNameProd1CategoryPage">
44+
<argument name="productName" value="{{productWithHTMLEntityOne.name}}"/>
45+
</actionGroup>
46+
<actionGroup ref="AssertStorefrontProductIsPresentOnCategoryPageActionGroup" stepKey="seeCorrectNameProd2CategoryPage">
47+
<argument name="productName" value="{{productWithHTMLEntityTwo.name}}"/>
48+
</actionGroup>
4349

4450
<!--Open product display page-->
45-
<click selector="{{StorefrontCategoryProductSection.ProductTitleByName(productWithHTMLEntityOne.name)}}" stepKey="clickProductToGoProductPage"/>
46-
<waitForPageLoad stepKey="waitForProductDisplayPageLoad2"/>
47-
48-
<see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="{{productWithHTMLEntityOne.name}}" stepKey="seeCorrectName"/>
51+
<actionGroup ref="StorefrontOpenProductFromCategoryPageActionGroup" stepKey="clickProductToGoProductPage">
52+
<argument name="productName" value="{{productWithHTMLEntityOne.name}}"/>
53+
</actionGroup>
54+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForProductDisplayPageLoad2"/>
55+
<actionGroup ref="StorefrontAssertProductNameOnProductPageActionGroup" stepKey="seeCorrectName">
56+
<argument name="productName" value="{{productWithHTMLEntityOne.name}}"/>
57+
</actionGroup>
4958
<actionGroup ref="StorefrontAssertProductSkuOnProductPageActionGroup" stepKey="seeCorrectSku">
5059
<argument name="productSku" value="{{productWithHTMLEntityOne.sku}}"/>
5160
</actionGroup>
52-
<see selector="{{StorefrontProductInfoMainSection.productPrice}}" userInput="${{productWithHTMLEntityOne.price}}" stepKey="seeCorrectPrice"/>
61+
<actionGroup ref="StorefrontAssertProductPriceOnProductPageActionGroup" stepKey="seeCorrectPrice">
62+
<argument name="productPrice" value="{{productWithHTMLEntityOne.price}}"/>
63+
</actionGroup>
5364

5465
<!--Veriy the breadcrumbs on Product Display page-->
55-
<see selector="{{StorefrontNavigationSection.breadcrumbs}}" userInput="Home" stepKey="seeHomePageInBreadcrumbs1"/>
56-
<see selector="{{StorefrontNavigationSection.breadcrumbs}}" userInput="$$createCategoryOne.name$$" stepKey="seeCorrectBreadCrumbCategory"/>
57-
<see selector="{{StorefrontNavigationSection.breadcrumbs}}" userInput="$$productOne.name$$" stepKey="seeCorrectBreadCrumbProduct"/>
66+
<actionGroup ref="AssertStorefrontBreadcrubmsAreShownActionGroup" stepKey="seeHomePageInBreadcrumbs1">
67+
<argument name="breadcrumbs" value="Home"/>
68+
</actionGroup>
69+
<actionGroup ref="AssertStorefrontBreadcrubmsAreShownActionGroup" stepKey="seeCorrectBreadCrumbCategory">
70+
<argument name="breadcrumbs" value="$$createCategoryOne.name$$"/>
71+
</actionGroup>
72+
<actionGroup ref="AssertStorefrontBreadcrubmsAreShownActionGroup" stepKey="seeCorrectBreadCrumbProduct">
73+
<argument name="breadcrumbs" value="$$productOne.name$$"/>
74+
</actionGroup>
5875

59-
<click selector="{{StorefrontNavigationSection.topCategory($$createCategoryOne.name$$)}}" stepKey="goBackToCategoryPage"/>
60-
<waitForPageLoad stepKey="waitforCategoryPageToLoad2"/>
76+
<actionGroup ref="StorefrontNavigateCategoryPageActionGroup" stepKey="goBackToCategoryPage">
77+
<argument name="category" value="$createCategoryOne$"/>
78+
</actionGroup>
79+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitforCategoryPageToLoad2"/>
6180

6281
<!--Open product display page-->
63-
<click selector="{{StorefrontCategoryProductSection.ProductTitleByName(productWithHTMLEntityTwo.name)}}" stepKey="clickProductToGoSecondProductPage"/>
64-
<waitForPageLoad stepKey="waitForProductDisplayPageLoad3"/>
82+
<actionGroup ref="StorefrontOpenProductFromCategoryPageActionGroup" stepKey="clickProductToGoSecondProductPage">
83+
<argument name="productName" value="{{productWithHTMLEntityTwo.name}}"/>
84+
</actionGroup>
85+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForProductDisplayPageLoad3"/>
6586

6687
<!--Verify the breadcrumbs on Product Display page-->
67-
<see selector="{{StorefrontNavigationSection.breadcrumbs}}" userInput="Home" stepKey="seeHomePageInBreadcrumbs2"/>
68-
<see selector="{{StorefrontNavigationSection.breadcrumbs}}" userInput="$$createCategoryOne.name$$" stepKey="seeCorrectBreadCrumbCategory2"/>
69-
<see selector="{{StorefrontNavigationSection.breadcrumbs}}" userInput="$$productTwo.name$$" stepKey="seeCorrectBreadCrumbProduct2"/>
70-
88+
<actionGroup ref="AssertStorefrontBreadcrubmsAreShownActionGroup" stepKey="seeHomePageInBreadcrumbs2">
89+
<argument name="breadcrumbs" value="Home"/>
90+
</actionGroup>
91+
<actionGroup ref="AssertStorefrontBreadcrubmsAreShownActionGroup" stepKey="seeCorrectBreadCrumbCategory2">
92+
<argument name="breadcrumbs" value="$$createCategoryOne.name$$"/>
93+
</actionGroup>
94+
<actionGroup ref="AssertStorefrontBreadcrubmsAreShownActionGroup" stepKey="seeCorrectBreadCrumbProduct2">
95+
<argument name="breadcrumbs" value="$$productTwo.name$$"/>
96+
</actionGroup>
7197
</test>
7298
</tests>

app/code/Magento/CatalogInventory/Model/StockManagement.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public function registerProductsSale($items, $websiteId = null)
119119
) {
120120
$this->getResource()->commit();
121121
throw new \Magento\Framework\Exception\LocalizedException(
122-
__('Not all of your products are available in the requested quantity.')
122+
__('Some of the products are out of stock.')
123123
);
124124
}
125125
if ($this->canSubtractQty($stockItem)) {
@@ -137,7 +137,7 @@ public function registerProductsSale($items, $websiteId = null)
137137
}
138138
$this->qtyCounter->correctItemsQty($registeredItems, $websiteId, '-');
139139
$this->getResource()->commit();
140-
140+
141141
return $fullSaveItems;
142142
}
143143

app/code/Magento/CatalogInventory/Model/StockStateProvider.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,9 @@ public function checkQty(StockItemInterface $stockItem, $qty)
249249
if (!$stockItem->getManageStock()) {
250250
return true;
251251
}
252+
if (!$stockItem->getIsInStock()) {
253+
return false;
254+
}
252255
if ($stockItem->getQty() - $stockItem->getMinQty() - $qty < 0) {
253256
switch ($stockItem->getBackorders()) {
254257
case \Magento\CatalogInventory\Model\Stock::BACKORDERS_YES_NONOTIFY:

app/code/Magento/CatalogInventory/Test/Unit/Model/Spi/StockStateProviderTest.php

Lines changed: 82 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,21 @@ public function testCheckQty(StockItemInterface $stockItem, $expectedResult)
200200
);
201201
}
202202

203+
/**
204+
* Check quantity with out-of-stock status but positive or 0 quantity.
205+
*
206+
* @param StockItemInterface $stockItem
207+
* @param mixed $expectedResult
208+
* @dataProvider checkQtyWithStockStatusDataProvider
209+
*/
210+
public function testCheckQtyWithPositiveQtyAndOutOfStockstatus(StockItemInterface $stockItem, $expectedResult)
211+
{
212+
$this->assertEquals(
213+
$expectedResult,
214+
$this->stockStateProvider->checkQty($stockItem, $this->qty)
215+
);
216+
}
217+
203218
/**
204219
* @param StockItemInterface $stockItem
205220
* @param mixed $expectedResult
@@ -281,6 +296,14 @@ public function checkQtyDataProvider()
281296
return $this->prepareDataForMethod('checkQty');
282297
}
283298

299+
/**
300+
* @return array
301+
*/
302+
public function checkQtyWithStockStatusDataProvider()
303+
{
304+
return $this->prepareDataForMethod('checkQty', $this->getVariationsForQtyAndStock());
305+
}
306+
284307
/**
285308
* @return array
286309
*/
@@ -315,12 +338,16 @@ public function checkQuoteItemQtyDataProvider()
315338

316339
/**
317340
* @param $methodName
341+
* @param array|null $options
318342
* @return array
319343
*/
320-
protected function prepareDataForMethod($methodName)
344+
protected function prepareDataForMethod($methodName, array $options = null)
321345
{
322346
$variations = [];
323-
foreach ($this->getVariations() as $variation) {
347+
if ($options === null) {
348+
$options = $this->getVariations();
349+
}
350+
foreach ($options as $variation) {
324351
$stockItem = $this->getMockBuilder(StockItemInterface::class)
325352
->disableOriginalConstructor()
326353
->setMethods($this->stockItemMethods)
@@ -360,7 +387,7 @@ protected function prepareDataForMethod($methodName)
360387
/**
361388
* @return array
362389
*/
363-
protected function getVariations()
390+
private function getVariations()
364391
{
365392
$stockQty = 100;
366393
return [
@@ -448,6 +475,58 @@ protected function getVariations()
448475
];
449476
}
450477

478+
/**
479+
* @return array
480+
*/
481+
private function getVariationsForQtyAndStock()
482+
{
483+
$stockQty = 100;
484+
return [
485+
[
486+
'values' => [
487+
'getIsInStock' => false,
488+
'getQty' => $stockQty,
489+
'getMinQty' => 60,
490+
'getMinSaleQty' => 1,
491+
'getMaxSaleQty' => 99,
492+
'getNotifyStockQty' => 101,
493+
'getManageStock' => true,
494+
'getBackorders' => 0,
495+
'getQtyIncrements' => 1,
496+
'_stock_qty_' => null,
497+
'_suppress_check_qty_increments_' => false,
498+
'_is_saleable_' => true,
499+
'_ordered_items_' => 0,
500+
'_product_' => 'Test product Name',
501+
],
502+
'results' => [
503+
'checkQty' => false
504+
]
505+
],
506+
[
507+
'values' => [
508+
'getIsInStock' => false,
509+
'getQty' => 0,
510+
'getMinQty' => 60,
511+
'getMinSaleQty' => 1,
512+
'getMaxSaleQty' => 99,
513+
'getNotifyStockQty' => 101,
514+
'getManageStock' => true,
515+
'getBackorders' => 0,
516+
'getQtyIncrements' => 1,
517+
'_stock_qty_' => null,
518+
'_suppress_check_qty_increments_' => false,
519+
'_is_saleable_' => true,
520+
'_ordered_items_' => 0,
521+
'_product_' => 'Test product Name',
522+
],
523+
'results' => [
524+
'checkQty' => false
525+
]
526+
]
527+
];
528+
}
529+
451530
/**
452531
* @param bool $isChildItem
453532
* @param string $expectedMsg

app/code/Magento/CatalogInventory/Test/Unit/Model/StockManagementTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ public function testRegisterProductsSale(
204204
public function testRegisterProductsSaleException(array $items, array $lockedItems)
205205
{
206206
$this->expectException('Magento\Framework\Exception\LocalizedException');
207-
$this->expectExceptionMessage('Not all of your products are available in the requested quantity.');
207+
$this->expectExceptionMessage('Some of the products are out of stock.');
208208
$this->stockResourceMock
209209
->expects($this->once())
210210
->method('beginTransaction');

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

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,32 @@
4646
</after>
4747

4848
<!-- Verify price is not discounted on category page -->
49-
<amOnPage url="{{StorefrontCategoryPage.url($createCategory.custom_attributes[url_key]$)}}" stepKey="openCategoryPageOnFrontend"/>
50-
<waitForPageLoad stepKey="waitForCategoryPageLoaded"/>
51-
<see selector="{{StorefrontCategoryProductSection.ProductPriceByNumber('1')}}" userInput="$$createProduct.price$$" stepKey="seeProductPriceOnCategoryPage"/>
49+
<actionGroup ref="StorefrontNavigateCategoryPageActionGroup" stepKey="openCategoryPageOnFrontend">
50+
<argument name="category" value="$$createCategory$$"/>
51+
</actionGroup>
52+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForCategoryPageLoaded"/>
53+
<actionGroup ref="StorefrontAssertProductPriceOnCategoryPageActionGroup" stepKey="seeProductPriceOnCategoryPage">
54+
<argument name="productName" value="$$createProduct.name$$"/>
55+
<argument name="productPrice" value="$$createProduct.price$$"/>
56+
</actionGroup>
5257

5358
<!-- Verify price is not discounted on the product page -->
54-
<amOnPage url="{{StorefrontProductPage.url($createProduct.custom_attributes[url_key]$)}}" stepKey="openProductPageOnFrontend"/>
55-
<waitForPageLoad stepKey="waitForProductPageLoaded"/>
56-
<see selector="{{StorefrontProductInfoMainSection.productPrice}}" userInput="$createProduct.price$" stepKey="seePriceOnProductPage"/>
59+
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="openProductPageOnFrontend">
60+
<argument name="product" value="$createProduct$"/>
61+
</actionGroup>
62+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForProductPageLoaded"/>
63+
<actionGroup ref="StorefrontAssertProductPriceOnProductPageActionGroup" stepKey="seePriceOnProductPage">
64+
<argument name="productPrice" value="$createProduct.price$"/>
65+
</actionGroup>
5766

5867
<!-- Verify price is not discounted in the cart -->
5968
<actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addToCartFromStorefrontProductPage">
6069
<argument name="productName" value="$createProduct.name$"/>
6170
</actionGroup>
6271
<actionGroup ref="StorefrontCartPageOpenActionGroup" stepKey="openCartPage" />
6372
<waitForElementVisible selector="{{CheckoutCartSummarySection.subtotal}}" stepKey="waitForSubtotalAppears"/>
64-
<see selector="{{CheckoutCartSummarySection.subtotal}}" userInput="$createProduct.price$" stepKey="seeProductPriceOnCartPage"/>
73+
<actionGroup ref="AssertStorefrontCheckoutPaymentSummarySubtotalActionGroup" stepKey="seeProductPriceOnCartPage">
74+
<argument name="orderSubtotal" value="$createProduct.price$"/>
75+
</actionGroup>
6576
</test>
6677
</tests>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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="AssertStorefrontRequiredFieldErrorMessageForProductOptionActionGroup">
12+
<see selector="{{StorefrontProductInfoMainSection.productAttributeOptionsError}}" userInput="This is a required field"
13+
stepKey="seeErrorMessage"/>
14+
</actionGroup>
15+
</actionGroups>

0 commit comments

Comments
 (0)