Skip to content

Commit c8b67b2

Browse files
author
Anna Bukatar
committed
ACP2E-813: Configurable Stock not updated after a child is back in stock
1 parent a785686 commit c8b67b2

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

dev/tests/integration/testsuite/Magento/CatalogInventory/Observer/SaveInventoryDataObserverTest.php

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
namespace Magento\CatalogInventory\Observer;
1010

11+
use Magento\TestFramework\Fixture\DataFixture;
1112
use Magento\TestFramework\Helper\Bootstrap;
1213
use PHPUnit\Framework\TestCase;
1314
use Magento\Catalog\Api\ProductRepositoryInterface;
@@ -21,6 +22,9 @@
2122
use Magento\Framework\Exception\CouldNotSaveException;
2223
use Magento\TestFramework\Fixture\DataFixtureStorage;
2324
use Magento\TestFramework\Fixture\DataFixtureStorageManager;
25+
use Magento\Catalog\Test\Fixture\Product as ProductFixture;
26+
use Magento\ConfigurableProduct\Test\Fixture\Attribute as AttributeFixture;
27+
use Magento\ConfigurableProduct\Test\Fixture\Product as ConfigurableProductFixture;
2428

2529
/**
2630
* Test for SaveInventoryDataObserver
@@ -91,15 +95,15 @@ public function testAutoChangingIsInStockForParent()
9195
$this->assertFalse($parentProductStockItem->getIsInStock());
9296
}
9397

94-
/**
95-
* Check that a configurable product will be created with out_of_stock status if no children in stock
96-
*
97-
* @magentoDataFixture Magento\Catalog\Test\Fixture\Product with:{"stock_item":{"qty": 0}} as:p1
98-
* @magentoDataFixture Magento\ConfigurableProduct\Test\Fixture\Attribute as:attr
99-
* @magentoDataFixture Magento\ConfigurableProduct\Test\Fixture\Product as:conf1
100-
* @magentoDataFixtureDataProvider {"conf1":{"_options":["$attr$"],"_links":["$p1$"]}}
101-
* @return void
102-
*/
98+
#[
99+
DataFixture(ProductFixture::class, ['stock_item' => ['qty' => 0]], 'p1'),
100+
DataFixture(AttributeFixture::class, as: 'attr'),
101+
DataFixture(
102+
ConfigurableProductFixture::class,
103+
['sku' => 'conf1','_options' => ['$attr$'],'_links' => ['$p1$']],
104+
'conf1'
105+
)
106+
]
103107
public function testAutoChangingIsInStockForNewConfigurable(): void
104108
{
105109
$sku = $this->fixtures->get('conf1')->getSku();

0 commit comments

Comments
 (0)