Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
UpdateCategoryEntityFlatDataTest.php
Go to the documentation of this file.
1 <?php
8 
10 use Magento\Mtf\TestStep\TestStepFactory;
14 
36 {
42  private $stepFactory;
43 
49  private $indexer;
50 
56  private $cron;
57 
63  private $configData;
64 
73  public function __prepare(Cron $cron, Indexer $indexer, TestStepFactory $stepFactory)
74  {
75  $this->cron = $cron;
76  $this->indexer = $indexer;
77  $this->stepFactory = $stepFactory;
78  }
79 
91  public function test(
92  Category $category,
93  Category $initialCategory,
94  Store $firstStore = null,
95  Store $secondStore = null,
96  $indexersMode = null,
97  $configData = null
98  ) {
99  $this->configData = $configData;
100 
101  //Preconditions
102  $firstStore->persist();
103  $secondStore->persist();
104  $this->cron->run();
105  $this->cron->run();
106 
107  $this->stepFactory->create(
108  \Magento\Config\Test\TestStep\SetupConfigurationStep::class,
109  ['configData' => $this->configData, 'flushCache' => true]
110  )->run();
111 
112  $this->indexer->setMode($indexersMode);
113  $this->indexer->reindex();
114 
115  return parent::test($category, $initialCategory);
116  }
117 
123  public function tearDown()
124  {
125  $this->stepFactory->create(
126  \Magento\Config\Test\TestStep\SetupConfigurationStep::class,
127  ['configData' => $this->configData, 'rollback' => true, 'flushCache' => true]
128  )->run();
129  $this->indexer->reindex();
130  }
131 }
test(Category $category, Category $initialCategory, Store $firstStore=null, Store $secondStore=null, $indexersMode=null, $configData=null)
$secondStore
__prepare(Cron $cron, Indexer $indexer, TestStepFactory $stepFactory)