|
8 | 8 |
|
9 | 9 | namespace Magento\CatalogInventory\Observer;
|
10 | 10 |
|
| 11 | +use Magento\TestFramework\Fixture\DataFixture; |
11 | 12 | use Magento\TestFramework\Helper\Bootstrap;
|
12 | 13 | use PHPUnit\Framework\TestCase;
|
13 | 14 | use Magento\Catalog\Api\ProductRepositoryInterface;
|
|
21 | 22 | use Magento\Framework\Exception\CouldNotSaveException;
|
22 | 23 | use Magento\TestFramework\Fixture\DataFixtureStorage;
|
23 | 24 | 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; |
24 | 28 |
|
25 | 29 | /**
|
26 | 30 | * Test for SaveInventoryDataObserver
|
@@ -91,15 +95,15 @@ public function testAutoChangingIsInStockForParent()
|
91 | 95 | $this->assertFalse($parentProductStockItem->getIsInStock());
|
92 | 96 | }
|
93 | 97 |
|
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 | + ] |
103 | 107 | public function testAutoChangingIsInStockForNewConfigurable(): void
|
104 | 108 | {
|
105 | 109 | $sku = $this->fixtures->get('conf1')->getSku();
|
|
0 commit comments