Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
magento2-base
dev
tests
integration
testsuite
Magento
Checkout
_files
quote_with_shipping_method_and_items_categories_rollback.php
Go to the documentation of this file.
1
<?php
6
declare(strict_types=1);
7
8
$objectManager
=
\Magento\TestFramework\Helper\Bootstrap::getObjectManager
();
10
$registry
=
$objectManager
->get(\
Magento
\Framework\Registry::class);
11
12
$registry
->unregister(
'isSecureArea'
);
13
$registry
->register(
'isSecureArea'
,
true
);
14
15
$productSkuList
= [
'simple_cat_3'
,
'simple_cat_4'
];
16
foreach
(
$productSkuList
as $sku) {
17
try
{
18
$productRepository
=
\Magento\TestFramework\Helper\Bootstrap::getObjectManager
()
19
->get(\
Magento
\Catalog\Api\ProductRepositoryInterface::class);
20
$product
=
$productRepository
->get($sku,
true
);
21
if
(
$product
->getId()) {
22
$productRepository
->delete(
$product
);
23
}
24
}
catch
(\
Magento
\Framework\Exception\NoSuchEntityException $e) {
25
//Product already removed
26
}
27
}
28
29
//Remove categories
31
$collection
=
$objectManager
->create(\
Magento
\Catalog\Model\
ResourceModel
\Category\Collection::class);
32
$collection
33
->addAttributeToFilter(
'level'
, 2)
34
->load()
35
->delete();
36
37
$quote
=
$objectManager
->create(\
Magento
\Quote\Model\Quote::class);
38
$quote
->load(
'test_order_1'
,
'reserved_order_id'
)->delete();
39
41
$quoteIdMask
=
$objectManager
->create(\
Magento
\Quote\Model\QuoteIdMask::class);
42
$quoteIdMask
->delete(
$quote
->getId());
43
44
require
__DIR__
.
'/../../Checkout/_files/quote_with_address_rollback.php'
;
45
46
$registry
->unregister(
'isSecureArea'
);
47
$registry
->register(
'isSecureArea'
,
false
);
$objectManager
$objectManager
Definition:
quote_with_shipping_method_and_items_categories_rollback.php:8
Magento\Catalog\Model\ResourceModel\Product
Definition:
CollectionTest.php:6
__DIR__
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition:
_bootstrap.php:60
$quoteIdMask
$quoteIdMask
Definition:
quote_with_shipping_method_and_items_categories_rollback.php:41
$productRepository
$productRepository
Definition:
bundle_product_with_not_visible_children.php:18
$collection
$collection
Definition:
quote_with_shipping_method_and_items_categories_rollback.php:31
Magento
$product
$product
Definition:
bundle_product_with_not_visible_children.php:22
$productSkuList
$productSkuList
Definition:
quote_with_shipping_method_and_items_categories_rollback.php:15
$quote
$quote
Definition:
quote_with_shipping_method_and_items_categories_rollback.php:37
$registry
$registry
Definition:
quote_with_shipping_method_and_items_categories_rollback.php:10
Magento\TestFramework\Helper\Bootstrap\getObjectManager
static getObjectManager()
Definition:
Bootstrap.php:125