Skip to content

Commit 582e520

Browse files
Merge branch '2.4.8-beta1-develop' into cia-2.4.8-beta1-develop-bugfix-05202024
2 parents 827c71b + 995a05c commit 582e520

File tree

56 files changed

+1373
-199
lines changed

Some content is hidden

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

56 files changed

+1373
-199
lines changed

app/code/Magento/Catalog/Test/Fixture/Product.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ class Product implements RevertibleDataFixtureInterface
3636
'visibility' => Visibility::VISIBILITY_BOTH,
3737
'status' => Status::STATUS_ENABLED,
3838
'custom_attributes' => [
39-
'tax_class_id' => '2'
39+
'tax_class_id' => '2',
40+
'special_price' => null,
4041
],
4142
'extension_attributes' => [
4243
'website_ids' => [1],

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1519,4 +1519,12 @@
15191519
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
15201520
<requiredEntity type="custom_attribute_array">CustomAttributeCategoryIds</requiredEntity>
15211521
</entity>
1522+
<entity name="ApiSimpleProductWithPrice1" type="product2" extends="ApiSimpleOne">
1523+
<data key="price">1</data>
1524+
<data key="weight">1</data>
1525+
</entity>
1526+
<entity name="SimpleProductWithWeight" extends="SimpleProduct50" type="product">
1527+
<data key="weight">1</data>
1528+
<data key="price">10</data>
1529+
</entity>
15221530
</entities>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@
137137
<generateDate date="now" format="m/d/Y" stepKey="generateCurrentDate"/>
138138
<generateDate date="-1 day" format="m/d/Y" stepKey="generateYesterdayDate"/>
139139
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndexPageToEditProduct1"/>
140+
<actionGroup ref="AdminClearFiltersActionGroup" stepKey="clearProductFilters"/>
140141
<actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="openEditSimpleProduct1">
141142
<argument name="product" value="$$createSimpleProduct1$$"/>
142143
</actionGroup>

app/code/Magento/CatalogInventoryGraphQl/Model/Resolver/OnlyXLeftInStockResolver.php

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
namespace Magento\CatalogInventoryGraphQl\Model\Resolver;
99

1010
use Magento\Catalog\Api\Data\ProductInterface;
11+
use Magento\Catalog\Api\ProductRepositoryInterface;
1112
use Magento\CatalogInventory\Api\StockRegistryInterface;
1213
use Magento\CatalogInventory\Model\Configuration;
1314
use Magento\Framework\App\Config\ScopeConfigInterface;
@@ -23,25 +24,20 @@
2324
class OnlyXLeftInStockResolver implements ResolverInterface
2425
{
2526
/**
26-
* @var ScopeConfigInterface
27+
* Configurable product type code
2728
*/
28-
private $scopeConfig;
29-
30-
/**
31-
* @var StockRegistryInterface
32-
*/
33-
private $stockRegistry;
29+
private const PRODUCT_TYPE_CONFIGURABLE = "configurable";
3430

3531
/**
3632
* @param ScopeConfigInterface $scopeConfig
3733
* @param StockRegistryInterface $stockRegistry
34+
* @param ProductRepositoryInterface $productRepositoryInterface
3835
*/
3936
public function __construct(
40-
ScopeConfigInterface $scopeConfig,
41-
StockRegistryInterface $stockRegistry
37+
private readonly ScopeConfigInterface $scopeConfig,
38+
private readonly StockRegistryInterface $stockRegistry,
39+
private readonly ProductRepositoryInterface $productRepositoryInterface
4240
) {
43-
$this->scopeConfig = $scopeConfig;
44-
$this->stockRegistry = $stockRegistry;
4541
}
4642

4743
/**
@@ -53,11 +49,12 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value
5349
throw new LocalizedException(__('"model" value should be specified'));
5450
}
5551

56-
/* @var $product ProductInterface */
5752
$product = $value['model'];
58-
$onlyXLeftQty = $this->getOnlyXLeftQty($product);
59-
60-
return $onlyXLeftQty;
53+
if ($product->getTypeId() === self::PRODUCT_TYPE_CONFIGURABLE) {
54+
$variant = $this->productRepositoryInterface->get($product->getSku());
55+
return $this->getOnlyXLeftQty($variant);
56+
}
57+
return $this->getOnlyXLeftQty($product);
6158
}
6259

6360
/**
@@ -73,7 +70,7 @@ private function getOnlyXLeftQty(ProductInterface $product): ?float
7370
Configuration::XML_PATH_STOCK_THRESHOLD_QTY,
7471
ScopeInterface::SCOPE_STORE
7572
);
76-
if ($thresholdQty === 0) {
73+
if ($thresholdQty === 0.0) {
7774
return null;
7875
}
7976

app/code/Magento/CatalogInventoryGraphQl/Test/Unit/Model/Resolver/OnlyXLeftInStockResolverTest.php

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,11 @@ protected function setUp(): void
115115
$this->stockStatusMock = $this->getMockBuilder(StockStatusInterface::class)->getMock();
116116
$this->productModelMock->expects($this->any())->method('getId')
117117
->willReturn(1);
118-
$this->productModelMock->expects($this->once())->method('getStore')
118+
$this->productModelMock->expects($this->atMost(1))->method('getStore')
119119
->willReturn($this->storeMock);
120-
$this->stockRegistryMock->expects($this->once())->method('getStockStatus')
120+
$this->stockRegistryMock->expects($this->atMost(1))->method('getStockStatus')
121121
->willReturn($this->stockStatusMock);
122-
$this->storeMock->expects($this->once())->method('getWebsiteId')->willReturn(1);
122+
$this->storeMock->expects($this->atMost(1))->method('getWebsiteId')->willReturn(1);
123123

124124
$this->resolver = $this->objectManager->getObject(
125125
OnlyXLeftInStockResolver::class,
@@ -181,15 +181,10 @@ public function testResolveOutStock()
181181

182182
public function testResolveNoThresholdQty()
183183
{
184-
$stockCurrentQty = 3;
185-
$minQty = 2;
186184
$thresholdQty = null;
187-
$this->stockItemMock->expects($this->once())->method('getMinQty')
188-
->willReturn($minQty);
189-
$this->stockStatusMock->expects($this->once())->method('getQty')
190-
->willReturn($stockCurrentQty);
191-
$this->stockRegistryMock->expects($this->once())->method('getStockItem')
192-
->willReturn($this->stockItemMock);
185+
$this->stockItemMock->expects($this->never())->method('getMinQty');
186+
$this->stockStatusMock->expects($this->never())->method('getQty');
187+
$this->stockRegistryMock->expects($this->never())->method('getStockItem');
193188
$this->scopeConfigMock->method('getValue')->willReturn($thresholdQty);
194189

195190
$this->assertEquals(

app/code/Magento/CatalogInventoryGraphQl/etc/schema.graphqls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# See COPYING.txt for license details.
33

44
interface ProductInterface {
5-
only_x_left_in_stock: Float @doc(description: "The value assigned to the Only X Left Threshold option in the Admin.") @resolver(class: "Magento\\CatalogInventoryGraphQl\\Model\\Resolver\\OnlyXLeftInStockResolver")
5+
only_x_left_in_stock: Float @doc(description: "Remaining stock if it is below the value assigned to the Only X Left Threshold option in the Admin.") @resolver(class: "Magento\\CatalogInventoryGraphQl\\Model\\Resolver\\OnlyXLeftInStockResolver")
66
stock_status: ProductStockStatus @doc(description: "The stock status of the product.") @resolver(class: "Magento\\CatalogInventoryGraphQl\\Model\\Resolver\\StockStatusProvider")
77
}
88

Lines changed: 45 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,45 @@
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-
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10-
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
11-
<entity name="Countries" type="countryArray">
12-
<array key="country">
13-
<item>Bahamas</item>
14-
</array>
15-
</entity>
16-
<entity name="DefaultCountriesWithRequiredRegions" type="countryArray">
17-
<array key="country">
18-
<item>Australia</item>
19-
<item>Brazil</item>
20-
<item>Canada</item>
21-
<item>Croatia</item>
22-
<item>Estonia</item>
23-
<item>India</item>
24-
<item>Latvia</item>
25-
<item>Lithuania</item>
26-
<item>Romania</item>
27-
<item>Spain</item>
28-
<item>Switzerland</item>
29-
<item>United States</item>
30-
<item>Australia</item>
31-
</array>
32-
</entity>
33-
<entity name="CustomCountryWithRequiredRegion" type="countryArray">
34-
<array key="country">
35-
<item>United Kingdom</item>
36-
</array>
37-
</entity>
38-
</entities>
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+
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
11+
<entity name="Countries" type="countryArray">
12+
<array key="country">
13+
<item>Bahamas</item>
14+
</array>
15+
</entity>
16+
<entity name="DefaultCountriesWithRequiredRegions" type="countryArray">
17+
<array key="country">
18+
<item>Australia</item>
19+
<item>Brazil</item>
20+
<item>Canada</item>
21+
<item>Croatia</item>
22+
<item>Estonia</item>
23+
<item>India</item>
24+
<item>Latvia</item>
25+
<item>Lithuania</item>
26+
<item>Romania</item>
27+
<item>Spain</item>
28+
<item>Switzerland</item>
29+
<item>United States</item>
30+
<item>Australia</item>
31+
</array>
32+
</entity>
33+
<entity name="CustomCountryWithRequiredRegion" type="countryArray">
34+
<array key="country">
35+
<item>United Kingdom</item>
36+
</array>
37+
</entity>
38+
<entity name="EuropeanCountry" type="countryArray">
39+
<array key="country">
40+
<item>France</item>
41+
<item>Germany</item>
42+
<item>United Kingdom</item>
43+
</array>
44+
</entity>
45+
</entities>

app/code/Magento/Checkout/Test/Mftf/Section/CheckoutShippingMethodsSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,6 @@
3636
<element name="shippingMethodDhlMedicalExpress" type="radio" selector="#checkout-shipping-method-load input[value='dhl_Q']"/>
3737
<element name="shippingMethodFreeShippingLabel" type="text" selector="#label_carrier_freeshipping_freeshipping"/>
3838
<element name="shippingDHLErrorMessage" type="text" selector="#checkout-shipping-method-load .table-checkout-shipping-method tr.row-error .error div"/>
39+
<element name="smartPostShippingMethod" type="radio" selector="#checkout-shipping-method-load input[value='fedex_FEDEX_GROUND']"/>
3940
</section>
4041
</sections>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868

6969
<!--Go to shopping cart-->
7070
<actionGroup ref="StorefrontCartPageOpenActionGroup" stepKey="amOnPageShoppingCart2"/>
71-
71+
7272
<!--Verify country options is shown by default-->
7373
<actionGroup ref="VerifyTopDestinationsCountryActionGroup" stepKey="verifyTopDestinationsCountry2">
7474
<argument name="country" value="Afghanistan"/>

app/code/Magento/Config/Test/Mftf/Section/StoreConfigSection.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,7 @@
1616
<element name="Country" type="select" selector="#general_store_information_country_id"/>
1717
<element name="fillVATNumber" type="input" selector="#general_store_information_merchant_vat_number"/>
1818
<element name="validateVATNumber" type="button" selector="#general_store_information_validate_vat_number" timeout="30"/>
19+
<element name="storeName" type="input" selector="#general_store_information_name"/>
20+
<element name="storePhoneNumber" type="input" selector="#general_store_information_phone"/>
1921
</section>
2022
</sections>

0 commit comments

Comments
 (0)