Skip to content

Commit cd94052

Browse files
MAGETWO-60918: Fatal error on Import/Export page if deleted category ids exists in category path
- Fix fixture for integration test.
1 parent c41bdce commit cd94052

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

dev/tests/integration/testsuite/Magento/CatalogImportExport/_files/product_export_with_broken_categories_path_rollback.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,18 @@
1616
/** @var \Magento\Catalog\Api\ProductRepositoryInterface $productRepository */
1717
$productRepository = $objectManager->create(\Magento\Catalog\Api\ProductRepositoryInterface::class);
1818

19-
$product = $productRepository->get('simple', false, null, true);
20-
$productRepository->delete($product);
19+
try {
20+
$product = $productRepository->get('simple', false, null, true);
21+
$productRepository->delete($product);
22+
} catch (\Magento\Framework\Exception\NoSuchEntityException $exception) {
23+
//Product already removed
24+
}
25+
26+
$productCollection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
27+
->get(\Magento\Catalog\Model\ResourceModel\Product\Collection::class);
28+
foreach ($productCollection as $product) {
29+
$product->delete();
30+
}
2131

2232
//Remove categories
2333
/** @var Magento\Catalog\Model\ResourceModel\Category\Collection $collection */

0 commit comments

Comments
 (0)