Skip to content

Commit 9914179

Browse files
committed
MC-37718: Grouped product remains In Stock On Mass Update
1 parent 4697cc1 commit 9914179

File tree

3 files changed

+26
-7
lines changed

3 files changed

+26
-7
lines changed

app/code/Magento/CatalogInventory/Plugin/MassUpdateProductAttribute.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
7+
68
namespace Magento\CatalogInventory\Plugin;
79

10+
use Magento\Catalog\Api\Data\ProductInterface;
811
use Magento\Catalog\Api\ProductRepositoryInterface;
912
use Magento\Catalog\Controller\Adminhtml\Product\Action\Attribute\Save;
10-
use Magento\Catalog\Model\Product;
1113
use Magento\CatalogInventory\Api\Data\StockItemInterface;
1214
use Magento\CatalogInventory\Observer\ParentItemProcessorInterface;
1315

@@ -181,10 +183,10 @@ private function updateInventoryInProducts($productIds, $websiteId, $inventoryDa
181183
/**
182184
* Process stock data for parent products
183185
*
184-
* @param Product $product
186+
* @param ProductInterface $product
185187
* @return void
186188
*/
187-
private function processParents(Product $product): void
189+
private function processParents(ProductInterface $product): void
188190
{
189191
foreach ($this->parentItemProcessors as $processor) {
190192
$processor->process($product);
Lines changed: 15 additions & 0 deletions
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+
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
11+
<entity name="AdminInventoryMassUpdateConsumerData">
12+
<data key="consumerName">inventory.mass.update</data>
13+
<data key="messageLimit">10</data>
14+
</entity>
15+
</entities>

app/code/Magento/GroupedProduct/Test/Mftf/Test/UpdateStockStatusGroupedProductTest.xml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<requiredEntity createDataKey="createGroupedProduct"/>
2828
<requiredEntity createDataKey="createFirstSimpleProduct"/>
2929
</createData>
30-
<magentoCron stepKey="runCronIndex" groups="index"/>
30+
<magentoCron groups="index" stepKey="runCronIndex"/>
3131
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
3232
</before>
3333
<after>
@@ -42,9 +42,11 @@
4242
<argument name="attributes" value="UpdateAttributeQtyAndStockToOutOfStock"/>
4343
<argument name="product" value="$$createFirstSimpleProduct$$"/>
4444
</actionGroup>
45-
<!--2.Run cron for updating stock status of parent product-->
46-
<magentoCLI command="cron:run" stepKey="runCron"/>
47-
<wait time="60" stepKey="waitForChanges"/>
45+
<!--2.Run cron for start consumer -->
46+
<actionGroup ref="CliConsumerStartActionGroup" stepKey="startMessageQueue">
47+
<argument name="consumerName" value="{{AdminInventoryMassUpdateConsumerData.consumerName}}"/>
48+
<argument name="maxMessages" value="{{AdminInventoryMassUpdateConsumerData.messageLimit}}"/>
49+
</actionGroup>
4850
<!--3.Check stock status of grouped product. Stock status should be "Out of Stock"-->
4951
<actionGroup ref="AssertAdminProductStockStatusActionGroup" stepKey="checkProductOutOfStock">
5052
<argument name="productId" value="$$createGroupedProduct.id$$"/>

0 commit comments

Comments
 (0)