Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
DeleteWebsiteEntityTest.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Backend\Test\Page\Adminhtml\DeleteWebsite;
10 use Magento\Backend\Test\Page\Adminhtml\EditWebsite;
11 use Magento\Backend\Test\Page\Adminhtml\StoreIndex;
12 use Magento\Backup\Test\Page\Adminhtml\BackupIndex;
13 use Magento\Store\Test\Fixture\Website;
14 use Magento\Mtf\TestCase\Injectable;
16 
38 class DeleteWebsiteEntityTest extends Injectable
39 {
40  /* tags */
41  const MVP = 'yes';
42  const SEVERITY = 'S3';
43  const STABLE = 'no';
44  /* end tags */
45 
51  protected $storeIndex;
52 
58  protected $editWebsite;
59 
65  protected $deleteWebsite;
66 
72  protected $backupIndex;
73 
83  public function __inject(
84  StoreIndex $storeIndex,
85  EditWebsite $editWebsite,
86  DeleteWebsite $deleteWebsite,
87  BackupIndex $backupIndex
88  ) {
89  $this->storeIndex = $storeIndex;
90  $this->editWebsite = $editWebsite;
91  $this->deleteWebsite = $deleteWebsite;
92  $this->backupIndex = $backupIndex;
93  }
94 
102  public function test(Website $website, $createBackup)
103  {
104  //Preconditions
105  $website->persist();
107  $enableBackupsStep = $this->objectManager->create(
108  SetupConfigurationStep::class,
109  ['configData' => 'enable_backups_functionality']
110  );
111  $enableBackupsStep->run();
112  $this->backupIndex->open()
113  ->getBackupGrid()
114  ->massaction([], 'Delete', true, 'Select All');
115 
116  //Steps
117  $this->storeIndex->open();
118  $this->storeIndex->getStoreGrid()->searchAndOpenWebsite($website);
119  $this->editWebsite->getFormPageActions()->delete();
120  $this->deleteWebsite->getDeleteWebsiteForm()->fillForm(['create_backup' => $createBackup]);
121  $this->deleteWebsite->getFormPageActions()->delete();
122  }
123 }
__inject(StoreIndex $storeIndex, EditWebsite $editWebsite, DeleteWebsite $deleteWebsite, BackupIndex $backupIndex)