Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
MoveStoreToOtherGroupSameWebsiteTest.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;
13 use Magento\Mtf\Fixture\FixtureFactory;
14 
37 class MoveStoreToOtherGroupSameWebsiteTest extends Injectable
38 {
39  /* tags */
40  const MVP = 'yes';
41  const SEVERITY = 'S1';
42  /* end tags */
43 
49  protected $storeIndex;
50 
56  protected $editStore;
57 
65  public function __inject(StoreIndex $storeIndex, EditStore $editStore)
66  {
67  $this->storeIndex = $storeIndex;
68  $this->editStore = $editStore;
69  }
70 
79  public function test(FixtureFactory $fixtureFactory, Store $storeInitialA, Store $storeInitialB)
80  {
81  // Prepare data for constraints
82  $store = $fixtureFactory->createByCode(
83  'store',
84  [
85  'data' => [
86  'name' => $storeInitialB->getName(),
87  'code' => $storeInitialB->getCode(),
88  'is_active' => $storeInitialB->getIsActive(),
89  'group_id' => [
90  'storeGroup' => $storeInitialA->getDataFieldConfig('group_id')['source']->getStoreGroup()
91  ],
92  ],
93  ]
94  );
95 
96  // Preconditions
97  $storeInitialA->persist();
98  $storeInitialB->persist();
99 
100  // Steps
101  $this->storeIndex->open();
102  $this->storeIndex->getStoreGrid()->searchAndOpenStore($storeInitialB);
103  $this->editStore->getStoreForm()->selectStore($storeInitialA->getGroupId());
104  $this->editStore->getFormPageActions()->save();
105  $this->editStore->getModalBlock()->acceptAlert();
106 
107  return ['store' => $store];
108  }
109 }
test(FixtureFactory $fixtureFactory, Store $storeInitialA, Store $storeInitialB)