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
Catalog
Model
Layer
Filter
Price
_files
products_base_rollback.php
Go to the documentation of this file.
1
<?php
11
\Magento\TestFramework\Helper\Bootstrap::getInstance
()->loadArea(
'adminhtml'
);
12
13
$testCases
= include
__DIR__
.
'/_algorithm_base_data.php'
;
14
16
$installer
=
\Magento\TestFramework\Helper\Bootstrap::getObjectManager
()->create(
17
\
Magento
\Catalog\Setup\CategorySetup::class
18
);
23
$category
=
\Magento\TestFramework\Helper\Bootstrap::getObjectManager
()->create(\
Magento
\Catalog\Model\Category::class);
24
$category
->isObjectNew(
true
);
25
$category
->setId(
26
3
27
)->setName(
28
'Root Category'
29
)->setParentId(
30
2
31
)->setPath(
32
'1/2/3'
33
)->setLevel(
34
2
35
)->setAvailableSortBy(
36
'name'
37
)->setDefaultSortBy(
38
'name'
39
)->setIsActive(
40
true
41
)->setPosition(
42
1
43
)->save();
44
45
$lastProductId
= 0;
46
foreach
(
$testCases
as
$index
=> $testCase) {
47
$category
=
\Magento\TestFramework\Helper\Bootstrap::getObjectManager
()->create(
48
\
Magento
\Catalog\Model\Category::class
49
);
50
$position =
$index
+ 1;
51
$categoryId =
$index
+ 4;
52
$category
->load($categoryId);
53
if
(
$category
->getId()) {
54
$category
->delete();
55
}
56
58
$productRepository
=
\Magento\TestFramework\Helper\Bootstrap::getObjectManager
()->create(
59
\
Magento
\Catalog\Api\ProductRepositoryInterface::class
60
);
61
62
foreach
($testCase[0] as
$price
) {
64
$product
=
\Magento\TestFramework\Helper\Bootstrap::getObjectManager
()->create(
65
\
Magento
\Catalog\Model\Product::class
66
);
67
$productId
=
$lastProductId
+ 1;
68
try
{
69
$product
=
$productRepository
->get(
'simple-'
.
$productId
,
false
,
null
,
true
);
70
$productRepository
->delete(
$product
);
71
}
catch
(\
Magento
\Framework\Exception\NoSuchEntityException $e) {
72
//Product already removed
73
}
74
++
$lastProductId
;
75
}
76
}
$productId
$productId
Definition:
website_attribute_sync.php:26
$testCases
$testCases
Definition:
products_base_rollback.php:13
Magento\TestFramework\Helper\Bootstrap\getInstance
static getInstance()
Definition:
Bootstrap.php:49
__DIR__
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition:
_bootstrap.php:60
$productRepository
$productRepository
Definition:
bundle_product_with_not_visible_children.php:18
$price
$price
Definition:
product_alert.php:10
Magento
$product
$product
Definition:
bundle_product_with_not_visible_children.php:22
$lastProductId
$lastProductId
Definition:
products_base_rollback.php:45
$installer
$installer
Definition:
products_base_rollback.php:16
$category
$category
Definition:
products_base_rollback.php:23
$index
$index
Definition:
list.phtml:44
Magento\TestFramework\Helper\Bootstrap\getObjectManager
static getObjectManager()
Definition:
Bootstrap.php:125