Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
UpdateStoreEntityTest.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Backend\Test\Page\Adminhtml\EditStore;
10 use Magento\Backend\Test\Page\Adminhtml\StoreIndex;
12 use Magento\Mtf\TestCase\Injectable;
14 
33 class UpdateStoreEntityTest extends Injectable
34 {
35  /* tags */
36  const MVP = 'yes';
37  const SEVERITY = 'S2';
38  /* end tags */
39 
45  protected $storeIndex;
46 
52  protected $editStore;
53 
59  private $restoreDefaultStoreViewStep;
60 
66  private $storeInitial;
67 
76  public function __inject(
77  StoreIndex $storeIndex,
78  EditStore $editStore,
79  RestoreDefaultStoreViewStep $restoreDefaultStoreViewStep
80  ) {
81  $this->storeIndex = $storeIndex;
82  $this->editStore = $editStore;
83  $this->restoreDefaultStoreViewStep = $restoreDefaultStoreViewStep;
84  }
85 
93  public function test(Store $storeInitial, Store $store)
94  {
95  // Preconditions:
96  $this->storeInitial = $storeInitial;
97  $storeInitial->persist();
98 
99  // Steps:
100  $this->storeIndex->open();
101  $this->storeIndex->getStoreGrid()->searchAndOpenStore($storeInitial);
102  $this->editStore->getStoreForm()->fill($store);
103  $this->editStore->getFormPageActions()->save();
104  }
105 
109  protected function tearDown()
110  {
111  if ($this->storeInitial->getCode() == 'default') {
112  $this->restoreDefaultStoreViewStep->run();
113  }
114  }
115 }
__inject(StoreIndex $storeIndex, EditStore $editStore, RestoreDefaultStoreViewStep $restoreDefaultStoreViewStep)