Skip to content

Commit 11c6818

Browse files
Fixing Import/ProductTest/ProductStockTest.php not cleaning
Tests were failing because they weren't cleaning the cache of stock statuses. Seems related to ACP2E-1760
1 parent 3402c78 commit 11c6818

File tree

1 file changed

+6
-1
lines changed
  • dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest

1 file changed

+6
-1
lines changed

dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest/ProductStockTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,15 @@ public function testImportWithBackordersDisabled(): void
157157
*/
158158
public function testProductStockStatusShouldBeUpdated()
159159
{
160+
$this->stockRegistryStorage->clean();
160161
$status = $this->stockRegistry->getStockStatusBySku('simple');
161162
$this->assertEquals(Stock::STOCK_IN_STOCK, $status->getStockStatus());
162163
$this->importFile('disable_product.csv');
164+
$this->stockRegistryStorage->clean();
163165
$status = $this->stockRegistry->getStockStatusBySku('simple');
164166
$this->assertEquals(Stock::STOCK_OUT_OF_STOCK, $status->getStockStatus());
165167
$this->importDataForMediaTest('enable_product.csv');
168+
$this->stockRegistryStorage->clean();
166169
$status = $this->stockRegistry->getStockStatusBySku('simple');
167170
$this->assertEquals(Stock::STOCK_IN_STOCK, $status->getStockStatus());
168171
}
@@ -177,17 +180,19 @@ public function testProductStockStatusShouldBeUpdated()
177180
*/
178181
public function testProductStockStatusShouldBeUpdatedOnSchedule()
179182
{
180-
/** * @var $indexProcessor \Magento\Indexer\Model\Processor */
181183
$indexProcessor = $this->objectManager->create(\Magento\Indexer\Model\Processor::class);
182184
$indexProcessor->updateMview();
185+
$this->stockRegistryStorage->clean();
183186
$status = $this->stockRegistry->getStockStatusBySku('simple');
184187
$this->assertEquals(Stock::STOCK_IN_STOCK, $status->getStockStatus());
185188
$this->importDataForMediaTest('disable_product.csv');
186189
$indexProcessor->updateMview();
190+
$this->stockRegistryStorage->clean();
187191
$status = $this->stockRegistry->getStockStatusBySku('simple');
188192
$this->assertEquals(Stock::STOCK_OUT_OF_STOCK, $status->getStockStatus());
189193
$this->importDataForMediaTest('enable_product.csv');
190194
$indexProcessor->updateMview();
195+
$this->stockRegistryStorage->clean();
191196
$status = $this->stockRegistry->getStockStatusBySku('simple');
192197
$this->assertEquals(Stock::STOCK_IN_STOCK, $status->getStockStatus());
193198
}

0 commit comments

Comments
 (0)