Skip to content

Commit c34f033

Browse files
Merge branch 'develop' into bluetooth_fix_invalid_preferences_commpr_3315
2 parents 4fd1b59 + 7b74816 commit c34f033

File tree

10 files changed

+263
-6
lines changed

10 files changed

+263
-6
lines changed

InventoryAdminUi/Test/Mftf/Test/StockStatusChangedForBundleProductOnTestStockAndTestWebsiteTest.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
<severity value="CRITICAL"/>
1818
<group value="msi"/>
1919
<group value="multi_mode"/>
20+
<!-- will be fixed in the scope of ACQE-6589 -->
21+
<group value="pr_exclude"/>
2022
</annotations>
2123

2224
<before>

InventoryAdminUi/Test/Mftf/Test/StorefrontCreateOrderAllQuantityGroupedProductOptionDefaultStockTest.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,11 @@
8484
<actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectCheckMoneyOrder"/>
8585
<actionGroup ref="ClickPlaceOrderActionGroup" stepKey="clickOnPlaceOrder"/>
8686
<!--Run queue consumer.-->
87-
<magentoCLI command="queue:consumers:start" arguments="inventory.reservations.updateSalabilityStatus" stepKey="startSalabilityUpdate" timeout="30"/>
87+
<magentoCLI command="queue:consumers:start" arguments="inventory.reservations.updateSalabilityStatus" stepKey="startSalabilityUpdate" timeout="60"/>
88+
<wait time="30" stepKey="waitForSalabilityUpdate"/>
89+
<actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache">
90+
<argument name="tags" value=""/>
91+
</actionGroup>
8892
<!--Navigate to group product PDP.-->
8993
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="navigateToGroupedProductPDPAfterOrderPlacement">
9094
<argument name="product" value="$groupedProduct$"/>

InventoryAdminUi/Test/Mftf/Test/StorefrontPriceOfConfigurableProductAssignedToTestStockAndTestWebsiteWhenOptionOfDisplayingOutOfStockProductsEnabledTest.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
<group value="msi"/>
1919
<group value="multi_mode"/>
2020
<group value="pr_exclude"/>
21+
<skip>
22+
<issueId value="AC-10843"/>
23+
</skip>
2124
</annotations>
2225

2326
<before>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="StorefrontValidateGroupedProductDisappearAfterEditingStockStatusToOutOfStockTest">
12+
<annotations>
13+
<stories value="Group Product Custom Stock."/>
14+
<title value="Validate that Grouped product gets disappear after editing stock status to out of stock"/>
15+
<description value="Admin create a grouped product and validate that Grouped product gets disappear after editing stock status to out of stock"/>
16+
<testCaseId value="AC-2834"/>
17+
<severity value="MINOR"/>
18+
</annotations>
19+
<actionGroup ref="AdminUpdateAssignSourceItemStatusOutOfStockForSimpleProduct" after="openProductToUpdateStock" stepKey="setOutOfStockForSimpleProduct">
20+
<argument name="sourceName" value="$$createSource.source[name]$$"/>
21+
</actionGroup>
22+
</test>
23+
</tests>

InventoryConfigurableProduct/Plugin/Model/ResourceModel/Attribute/IsEnabledOptionSelectBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function afterGetSelect(
8282
. " AND entity_status_store.store_id = {$storeId}",
8383
[]
8484
)->where(
85-
$select->getConnection()->getIfNullSql('entity_status_global.value', 'entity_status_store.value') . ' = ?',
85+
$select->getConnection()->getIfNullSql('entity_status_store.value', 'entity_status_global.value') . ' = ?',
8686
ProductStatus::STATUS_ENABLED
8787
);
8888

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
<?php
2+
/*************************
3+
*
4+
* Copyright 2024 Adobe
5+
* All Rights Reserved.
6+
*
7+
* ***********************
8+
*/
9+
declare(strict_types=1);
10+
11+
namespace Magento\InventoryConfigurableProduct\Test\Unit\Plugin\Model\ResourceModel\Attribute;
12+
13+
use Magento\Catalog\Api\Data\ProductInterface;
14+
use Magento\Framework\DB\Adapter\AdapterInterface;
15+
use Magento\Framework\DB\Select;
16+
use Magento\Eav\Model\Entity\Attribute\AbstractAttribute;
17+
use Magento\Framework\App\ScopeInterface;
18+
use Magento\Catalog\Api\ProductAttributeRepositoryInterface;
19+
use Magento\ConfigurableProduct\Model\ResourceModel\Attribute\OptionSelectBuilderInterface;
20+
use Magento\Framework\EntityManager\EntityMetadataInterface;
21+
use Magento\Framework\EntityManager\MetadataPool;
22+
use Magento\Framework\Exception\NoSuchEntityException;
23+
use Magento\InventoryConfigurableProduct\Plugin\Model\ResourceModel\Attribute\IsEnabledOptionSelectBuilder;
24+
use Magento\Store\Model\Store;
25+
use Magento\Catalog\Model\Product\Attribute\Source\Status as ProductStatus;
26+
use PHPUnit\Framework\MockObject\Exception;
27+
use PHPUnit\Framework\MockObject\MockObject;
28+
use PHPUnit\Framework\TestCase;
29+
30+
/**
31+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
32+
*/
33+
class IsEnabledOptionSelectBuilderTest extends TestCase
34+
{
35+
/**
36+
* @var ProductAttributeRepositoryInterface|MockObject
37+
*/
38+
private ProductAttributeRepositoryInterface $attributeRepository;
39+
40+
/**
41+
* @var MetadataPool|MockObject
42+
*/
43+
private MetadataPool $metadataPool;
44+
45+
/**
46+
* @inheritdoc
47+
*/
48+
protected function setUp(): void
49+
{
50+
$this->attributeRepository = $this->createMock(ProductAttributeRepositoryInterface::class);
51+
$this->metadataPool = $this->createMock(MetadataPool::class);
52+
}
53+
54+
/**
55+
* @return void
56+
* @throws NoSuchEntityException
57+
* @throws Exception
58+
*/
59+
public function testAfterGetSelect(): void
60+
{
61+
$subject = $this->createMock(OptionSelectBuilderInterface::class);
62+
$superAttribute = $this->createMock(AbstractAttribute::class);
63+
$productId = 1;
64+
65+
$scope = $this->createMock(ScopeInterface::class);
66+
$scope->expects($this->once())->method('getId')->willReturn(1);
67+
68+
$status = $this->createMock(AbstractAttribute::class);
69+
$status->expects($this->exactly(2))
70+
->method('getBackendTable')
71+
->willReturn('catalog_product_entity_int');
72+
$status->expects($this->exactly(2))->method('getAttributeId')->willReturn(95);
73+
74+
$metadata = $this->createMock(EntityMetadataInterface::class);
75+
$metadata->expects($this->once())->method('getLinkField')->willReturn('row_id');
76+
$this->metadataPool->expects($this->once())->method('getMetadata')
77+
->with(ProductInterface::class)
78+
->willReturn($metadata);
79+
$this->attributeRepository->expects($this->once())
80+
->method('get')
81+
->with(ProductInterface::STATUS)
82+
->willReturn($status);
83+
84+
$adapter = $this->createMock(AdapterInterface::class);
85+
$adapter->expects($this->once())
86+
->method('getIfNullSql')
87+
->with('entity_status_store.value', 'entity_status_global.value')
88+
->willReturn('IFNULL(entity_status_store.value, entity_status_global.value) = 1');
89+
90+
$select = $this->createMock(Select::class);
91+
$select->expects($this->once())->method('getConnection')->willReturn($adapter);
92+
$select->expects($this->once())->method('joinInner')->with(
93+
['entity_status_global' => 'catalog_product_entity_int'],
94+
"entity_status_global.row_id = entity.row_id"
95+
. " AND entity_status_global.attribute_id = 95"
96+
. " AND entity_status_global.store_id = " . Store::DEFAULT_STORE_ID,
97+
[]
98+
)->willReturnSelf();
99+
$select->expects($this->once())->method('joinLeft')->with(
100+
['entity_status_store' => 'catalog_product_entity_int'],
101+
"entity_status_store.row_id = entity.row_id"
102+
. " AND entity_status_store.attribute_id = 95"
103+
. " AND entity_status_store.store_id = 1",
104+
[]
105+
)->willReturnSelf();
106+
$select->expects($this->once())->method('where')->with(
107+
'IFNULL(entity_status_store.value, entity_status_global.value) = 1 = ?',
108+
ProductStatus::STATUS_ENABLED
109+
)->willReturnSelf();
110+
111+
$plugin = new IsEnabledOptionSelectBuilder($this->attributeRepository, $this->metadataPool);
112+
$plugin->afterGetSelect($subject, $select, $superAttribute, $productId, $scope);
113+
}
114+
}

InventoryDistanceBasedSourceSelection/Model/DistanceProvider/GoogleMap/GetApiKey.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function __construct(
4141
*/
4242
public function execute(): string
4343
{
44-
$apiKey = trim((string) $this->scopeConfig->getValue(self::XML_PATH_API_KEY));
44+
$apiKey = trim((string) $this->scopeConfig->getValue(self::XML_PATH_API_KEY) ?? '');
4545
if (!$apiKey) {
4646
throw new LocalizedException(__('Google API key is not defined'));
4747
}
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="StorefrontValidateGroupedProductDisappearAfterEditingStockStatusToOutOfStockTest">
12+
<annotations>
13+
<stories value="Group Product Custom Stock."/>
14+
<title value="Validate that Grouped product gets disappear after editing stock status to out of stock"/>
15+
<description value="Admin create a grouped product and validate that Grouped product gets disappear after editing stock status to out of stock"/>
16+
<testCaseId value="AC-2834"/>
17+
<severity value="MINOR"/>
18+
</annotations>
19+
<before>
20+
<!--Create a subcategory-->
21+
<createData entity="SimpleSubCategory" stepKey="category"/>
22+
<!--Create a simple product-->
23+
<createData entity="SimpleProduct" stepKey="createSimpleProduct">
24+
<field key="price">10.00</field>
25+
<field key="name">Simple Product 1</field>
26+
<requiredEntity createDataKey="category"/>
27+
</createData>
28+
<createData entity="ApiGroupedProduct" stepKey="createGroupedProduct"/>
29+
<!-- Create a grouped product and assign simple product in it-->
30+
<createData entity="OneSimpleProductLink" stepKey="linkSimpleProduct">
31+
<requiredEntity createDataKey="createGroupedProduct"/>
32+
<requiredEntity createDataKey="createSimpleProduct"/>
33+
</createData>
34+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
35+
</before>
36+
<after>
37+
<!--Delete created data-->
38+
<deleteData createDataKey="createSimpleProduct" stepKey="deleteFirstSimpleProduct"/>
39+
<deleteData createDataKey="createGroupedProduct" stepKey="deleteGroupedProduct"/>
40+
<deleteData createDataKey="category" stepKey="deleteCategory"/>
41+
<actionGroup ref="AssignWebsiteToStockActionGroup" stepKey="assignMainWebsiteToDefaultStock">
42+
<argument name="stockName" value="{{_defaultStock.name}}"/>
43+
<argument name="websiteName" value="{{_defaultWebsite.name}}"/>
44+
</actionGroup>
45+
<actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearFilter"/>
46+
<deleteData createDataKey="createStock" stepKey="deleteCustomStock"/>
47+
<!--Disable all sources.-->
48+
<actionGroup ref="DisableAllSourcesActionGroup" stepKey="deleteSource"/>
49+
<!--Admin logout-->
50+
<actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/>
51+
</after>
52+
<!--Create source and stock-->
53+
<createData entity="FullSource1" stepKey="createSource"/>
54+
<createData entity="BasicMsiStockWithMainWebsite1" stepKey="createStock"/>
55+
<createData entity="SourceStockLinked1" stepKey="sourceStockLink">
56+
<requiredEntity createDataKey="createStock"/>
57+
<requiredEntity createDataKey="createSource"/>
58+
</createData>
59+
<!-- Assign Test source to simple product -->
60+
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="openProductBeforeStaging">
61+
<argument name="productId" value="$createSimpleProduct.id$"/>
62+
</actionGroup>
63+
<waitForPageLoad stepKey="waitForSimpleProductEditPage"/>
64+
<actionGroup ref="UnassignSourceFromProductActionGroup" stepKey="unAssignDefaultSourceFromProduct">
65+
<argument name="sourceCode" value="{{_defaultSource.name}}"/>
66+
</actionGroup>
67+
<actionGroup ref="AdminAssignSourceToProductAndSetSourceQuantityActionGroup" stepKey="assignCreatedSourceToFirstChildProduct">
68+
<argument name="sourceCode" value="$createSource.source[source_code]$"/>
69+
</actionGroup>
70+
<fillField selector="{{AdminProductSourcesGrid.rowQty('0')}}" userInput="5" stepKey="fillSourceQtyField1"/>
71+
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveCreateFirstSimpleProduct"/>
72+
<!-- Add category and change source quantity to grouped product -->
73+
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="openGroupedProduct">
74+
<argument name="productId" value="$createGroupedProduct.id$"/>
75+
</actionGroup>
76+
<actionGroup ref="SetCategoryByNameActionGroup" stepKey="addCategoryToGroupedProduct">
77+
<argument name="categoryName" value="$$category.name$$"/>
78+
</actionGroup>
79+
<actionGroup ref="FillDefaultQuantityForLinkedToGroupProductInGridActionGroup" stepKey="fillDefaultQtyForSimpleProduct">
80+
<argument name="productName" value="$$createSimpleProduct.name$$"/>
81+
<argument name="qty" value="5"/>
82+
</actionGroup>
83+
<actionGroup ref="AdminFormSaveAndCloseActionGroup" stepKey="saveAndCloseGroupedProduct"/>
84+
<!--Flush cache and Reindex-->
85+
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
86+
<argument name="indices" value=""/>
87+
</actionGroup>
88+
<actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache">
89+
<argument name="tags" value="config full_page"/>
90+
</actionGroup>
91+
<!--Go to storefront and open category and then assert grouped product is present-->
92+
<actionGroup ref="StorefrontGoToCategoryPageActionGroup" stepKey="againOpenEnabledCategory">
93+
<argument name="categoryName" value="$$category.name$$"/>
94+
</actionGroup>
95+
<waitForText userInput="$$createGroupedProduct.name$$" selector="{{StorefrontCategoryMainSection.specifiedProductItemInfo($$createGroupedProduct.name$$)}}" stepKey="seeGroupedProduct"/>
96+
<!--Go to simple product and update status as out of stock-->
97+
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="openProductToUpdateStock">
98+
<argument name="productId" value="$createSimpleProduct.id$"/>
99+
</actionGroup>
100+
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductPostOutOfStock"/>
101+
<!--Go to storefront and open category and then assert grouped product is not present-->
102+
<actionGroup ref="StorefrontGoToCategoryPageActionGroup" stepKey="openEnabledCategory">
103+
<argument name="categoryName" value="$$category.name$$"/>
104+
</actionGroup>
105+
<dontSee userInput="$$createGroupedProduct.name$$" selector="{{StorefrontCategoryMainSection.specifiedProductItemInfo($$createGroupedProduct.name$$)}}" stepKey="dontSeeGroupedProduct"/>
106+
</test>
107+
</tests>

InventoryInStorePickup/Model/SearchRequest/Area/SearchTerm/CountryParser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,6 @@ private function getCountry(string $searchTerm): ?string
6161
}
6262
$searchTerm = explode($this->delimiterConfig->getDelimiter(), $searchTerm);
6363

64-
return trim(end($searchTerm));
64+
return trim(end($searchTerm) ?? '');
6565
}
6666
}

InventoryReservations/Model/ReservationBuilder.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ public function build(): ReservationInterface
133133
}
134134

135135
/**
136+
* Validate
137+
*
136138
* @return ValidationResult
137139
*/
138140
private function validate()
@@ -143,7 +145,7 @@ private function validate()
143145
$errors[] = __('"%field" is expected to be a number.', ['field' => ReservationInterface::STOCK_ID]);
144146
}
145147

146-
if (null === $this->sku || '' === trim($this->sku)) {
148+
if (null === $this->sku || '' === trim($this->sku ?? '')) {
147149
$errors[] = __('"%field" can not be empty.', ['field' => ReservationInterface::SKU]);
148150
}
149151

@@ -156,6 +158,7 @@ private function validate()
156158

157159
/**
158160
* Used to clean state after object creation
161+
*
159162
* @return void
160163
*/
161164
private function reset()
@@ -168,7 +171,8 @@ private function reset()
168171

169172
/**
170173
* Used to convert database field names (that use snake case) into constructor parameter names (that use camel case)
171-
* to avoid to define them twice in domain model interface.
174+
*
175+
* To avoid to define them twice in domain model interface.
172176
*
173177
* @param array $array
174178
* @return array

0 commit comments

Comments
 (0)