Skip to content

Commit 6d99e19

Browse files
committed
Tests refactoring
1 parent c0df80b commit 6d99e19

File tree

5 files changed

+9
-6
lines changed

5 files changed

+9
-6
lines changed

dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_options.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
$customOptions = [];
9090

9191
/** @var \Magento\Catalog\Api\Data\ProductCustomOptionInterfaceFactory $customOptionFactory */
92-
$customOptionFactory = $objectManager->create(\Magento\Catalog\Api\Data\ProductCustomOptionInterfaceFactory::class);
92+
$customOptionFactory = $objectManager->get(\Magento\Catalog\Api\Data\ProductCustomOptionInterfaceFactory::class);
9393

9494
foreach ($options as $option) {
9595
/** @var \Magento\Catalog\Api\Data\ProductCustomOptionInterface $customOption */
@@ -102,5 +102,5 @@
102102
$product->setOptions($customOptions);
103103

104104
/** @var \Magento\Catalog\Api\ProductRepositoryInterface $productRepositoryFactory */
105-
$productRepository = $objectManager->create(\Magento\Catalog\Api\ProductRepositoryInterface::class);
105+
$productRepository = $objectManager->get(\Magento\Catalog\Api\ProductRepositoryInterface::class);
106106
$productRepository->save($product);

dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_options_rollback.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@
1515
);
1616
try {
1717
$product = $repository->get('simple', false, null, true);
18-
$product->delete();
18+
$repository->delete($product);
1919
} catch (\Magento\Framework\Exception\NoSuchEntityException $e) {
2020
//Entity already deleted
21+
} catch (\Magento\Framework\Exception\StateException $e) {
22+
2123
}
2224

2325
$registry->unregister('isSecureArea');

dev/tests/integration/testsuite/Magento/Catalog/_files/product_virtual.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@
2828
]
2929
);
3030
/** @var ProductResource $productResource */
31-
$productResource = Bootstrap::getObjectManager()->create(ProductResource::class);
31+
$productResource = Bootstrap::getObjectManager()->get(ProductResource::class);
3232
$productResource->save($product);

dev/tests/integration/testsuite/Magento/Catalog/_files/product_virtual_with_options.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
$customOptions = [];
9090

9191
/** @var \Magento\Catalog\Api\Data\ProductCustomOptionInterfaceFactory $customOptionFactory */
92-
$customOptionFactory = $objectManager->create(\Magento\Catalog\Api\Data\ProductCustomOptionInterfaceFactory::class);
92+
$customOptionFactory = $objectManager->get(\Magento\Catalog\Api\Data\ProductCustomOptionInterfaceFactory::class);
9393

9494
foreach ($options as $option) {
9595
/** @var \Magento\Catalog\Api\Data\ProductCustomOptionInterface $customOption */

dev/tests/integration/testsuite/Magento/Catalog/_files/product_virtual_with_options_rollback.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515
);
1616
try {
1717
$product = $repository->get('virtual', false, null, true);
18-
$product->delete();
18+
$repository->delete($product);
1919
} catch (\Magento\Framework\Exception\NoSuchEntityException $e) {
2020
//Entity already deleted
21+
} catch (\Magento\Framework\Exception\StateException $e) {
2122
}
2223

2324
$registry->unregister('isSecureArea');

0 commit comments

Comments
 (0)