Skip to content

Commit 48eb494

Browse files
Merge branch 'develop' into cia-2.4.8-beta1-develop-2.4-develop-sync-09122024
2 parents c5ba965 + 3df4d6f commit 48eb494

File tree

9 files changed

+130
-9
lines changed

9 files changed

+130
-9
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$"/>

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
}

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
}

InventoryInStorePickup/etc/di.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
<preference for="Magento\InventoryInStorePickupApi\Api\GetPickupLocationsInterface" type="Magento\InventoryInStorePickup\Model\GetPickupLocations" />
2727
<preference for="Magento\InventoryInStorePickupApi\Model\GetPickupLocationInterface" type="Magento\InventoryInStorePickup\Model\GetPickupLocation"/>
2828
<preference for="Magento\InventoryInStorePickupApi\Api\Data\SearchResultInterface" type="Magento\InventoryInStorePickup\Model\SearchResult"/>
29-
<preference for="Magento\InventoryInStorePickupApi\Model\SearchResult\ExtractStrategyInterface" type="Magento\InventoryInStorePickup\Model\SearchResult\ExtractStrategy" />
3029
<type name="Magento\InventoryInStorePickupApi\Model\SearchCriteriaResolverInterface">
3130
<arguments>
3231
<argument name="resolvers" xsi:type="array">

InventoryInStorePickupShipping/etc/di.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
99
<preference for="Magento\InventoryInStorePickupShippingApi\Model\Carrier\Command\GetFreePackagesInterface" type="Magento\InventoryInStorePickupShipping\Model\Carrier\Command\GetFreePackages" />
10-
<preference for="Magento\InventoryInStorePickupShippingApi\Api\Data\ShippingPriceRequestInterface" type="Magento\InventoryInStorePickupShipping\Model\Carrier\ShippingPriceRequest" />
1110
<preference for="Magento\InventoryInStorePickupShippingApi\Model\Carrier\Command\GetShippingPriceInterface" type="Magento\InventoryInStorePickupShipping\Model\Carrier\Command\GetShippingPrice" />
12-
<preference for="Magento\InventoryInStorePickupShippingApi\Model\Carrier\Command\GetShippingPriceRequestInterface" type="Magento\InventoryInStorePickupShipping\Model\Carrier\Command\GetShippingPriceRequest" />
1311
<preference for="Magento\InventoryInStorePickupShippingApi\Model\IsInStorePickupDeliveryCartInterface" type="Magento\InventoryInStorePickupShipping\Model\IsInStorePickupDeliveryCart" />
1412
<preference for="Magento\InventoryInStorePickupShippingApi\Model\IsInStorePickupDeliveryAvailableForCartInterface" type="Magento\InventoryInStorePickupShipping\Model\IsInStorePickupDeliveryAvailableForCart"/>
1513
<type name="Magento\InventoryInStorePickupShippingApi\Model\Carrier\Validation\RequestValidatorChain">

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)