Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
DeleteStoreEntityTest.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\StoreDelete;
11 use Magento\Backend\Test\Page\Adminhtml\StoreIndex;
12 use Magento\Backup\Test\Page\Adminhtml\BackupIndex;
14 use Magento\Mtf\TestCase\Injectable;
16 
37 class DeleteStoreEntityTest extends Injectable
38 {
39  /* tags */
40  const MVP = 'yes';
41  const SEVERITY = 'S2';
42  /* end tags */
43 
49  protected $backupIndex;
50 
56  protected $storeIndex;
57 
63  protected $editStore;
64 
70  protected $storeDelete;
71 
81  public function __inject(
82  BackupIndex $backupIndex,
83  StoreIndex $storeIndex,
84  EditStore $editStore,
85  StoreDelete $storeDelete
86  ) {
87  $this->storeIndex = $storeIndex;
88  $this->editStore = $editStore;
89  $this->backupIndex = $backupIndex;
90  $this->storeDelete = $storeDelete;
91  }
92 
100  public function test(Store $store, $createBackup)
101  {
102  // Preconditions:
103  $store->persist();
105  $enableBackupsStep = $this->objectManager->create(
106  SetupConfigurationStep::class,
107  ['configData' => 'enable_backups_functionality']
108  );
109  $enableBackupsStep->run();
110  $this->backupIndex->open()
111  ->getBackupGrid()
112  ->massaction([], 'Delete', true, 'Select All');
113 
114  // Steps:
115  $this->storeIndex->open();
116  $this->storeIndex->getStoreGrid()->searchAndOpenStore($store);
117  $this->editStore->getFormPageActions()->delete();
118  $this->storeDelete->getStoreForm()->fillForm(['create_backup' => $createBackup]);
119  $this->storeDelete->getFormPageActions()->delete();
120  $this->storeDelete->getModalBlock()->acceptAlert();
121  }
122 }
__inject(BackupIndex $backupIndex, StoreIndex $storeIndex, EditStore $editStore, StoreDelete $storeDelete)