Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
products_base_rollback.php
Go to the documentation of this file.
1 <?php
12 
13 $testCases = include __DIR__ . '/_algorithm_base_data.php';
14 
17  \Magento\Catalog\Setup\CategorySetup::class
18 );
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 
46 foreach ($testCases as $index => $testCase) {
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 
59  \Magento\Catalog\Api\ProductRepositoryInterface::class
60  );
61 
62  foreach ($testCase[0] as $price) {
65  \Magento\Catalog\Model\Product::class
66  );
68  try {
69  $product = $productRepository->get('simple-' . $productId, false, null, true);
71  } catch (\Magento\Framework\Exception\NoSuchEntityException $e) {
72  //Product already removed
73  }
75  }
76 }
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition: _bootstrap.php:60
$price
$index
Definition: list.phtml:44