Skip to content

Commit 12a4d00

Browse files
committed
MAGETWO-60746: [GITHUB] Edit default store view will stop saying that Default store cannot be disabled #7349
- Add functional test
1 parent b4035b5 commit 12a4d00

File tree

3 files changed

+80
-2
lines changed

3 files changed

+80
-2
lines changed

dev/tests/functional/tests/app/Magento/Store/Test/TestCase/UpdateStoreEntityTest.php

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Magento\Backend\Test\Page\Adminhtml\StoreIndex;
1111
use Magento\Store\Test\Fixture\Store;
1212
use Magento\Mtf\TestCase\Injectable;
13+
use Magento\Store\Test\TestStep\RestoreDefaultStoreViewStep;
1314

1415
/**
1516
* Test Creation for UpdateStoreEntity (Store Management)
@@ -50,17 +51,36 @@ class UpdateStoreEntityTest extends Injectable
5051
*/
5152
protected $editStore;
5253

54+
/**
55+
* Restore Default Store View step.
56+
*
57+
* @var RestoreDefaultStoreViewStep
58+
*/
59+
private $restoreDefaultStoreViewStep;
60+
61+
/**
62+
* Initial store fixture.
63+
*
64+
* @var Store
65+
*/
66+
private $storeInitial;
67+
5368
/**
5469
* Preparing pages for test
5570
*
5671
* @param StoreIndex $storeIndex
5772
* @param EditStore $editStore
73+
* @param RestoreDefaultStoreViewStep $restoreDefaultStoreViewStep
5874
* @return void
5975
*/
60-
public function __inject(StoreIndex $storeIndex, EditStore $editStore)
61-
{
76+
public function __inject(
77+
StoreIndex $storeIndex,
78+
EditStore $editStore,
79+
RestoreDefaultStoreViewStep $restoreDefaultStoreViewStep
80+
) {
6281
$this->storeIndex = $storeIndex;
6382
$this->editStore = $editStore;
83+
$this->restoreDefaultStoreViewStep = $restoreDefaultStoreViewStep;
6484
}
6585

6686
/**
@@ -73,6 +93,7 @@ public function __inject(StoreIndex $storeIndex, EditStore $editStore)
7393
public function test(Store $storeInitial, Store $store)
7494
{
7595
// Preconditions:
96+
$this->storeInitial = $storeInitial;
7697
$storeInitial->persist();
7798

7899
// Steps:
@@ -81,4 +102,14 @@ public function test(Store $storeInitial, Store $store)
81102
$this->editStore->getStoreForm()->fill($store);
82103
$this->editStore->getFormPageActions()->save();
83104
}
105+
106+
/**
107+
* {@inheritdoc}
108+
*/
109+
public function tearDown()
110+
{
111+
if($this->storeInitial->getCode() == 'default') {
112+
$this->restoreDefaultStoreViewStep->run();
113+
}
114+
}
84115
}

dev/tests/functional/tests/app/Magento/Store/Test/TestCase/UpdateStoreEntityTest.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,11 @@
2020
<constraint name="Magento\Store\Test\Constraint\AssertStoreBackend" />
2121
<constraint name="Magento\Store\Test\Constraint\AssertStoreFrontend" />
2222
</variation>
23+
<variation name="UpdateStoreEntityTestVariation2">
24+
<data name="tag" xsi:type="string">severity:S1</data>
25+
<data name="storeInitial/dataset" xsi:type="string">default</data>
26+
<data name="store/data/name" xsi:type="string">storename_updated%isolation%</data>
27+
<constraint name="Magento\Store\Test\Constraint\AssertStoreSuccessSaveMessage" />
28+
</variation>
2329
</testCase>
2430
</config>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Store\Test\TestStep;
8+
9+
use Magento\Mtf\TestStep\TestStepInterface;
10+
use Magento\Store\Test\Fixture\Store;
11+
12+
/**
13+
* Restore DefaultStore view.
14+
*/
15+
class RestoreDefaultStoreViewStep implements TestStepInterface
16+
{
17+
/**
18+
* Fixture of Store View.
19+
*
20+
* @var Store
21+
*/
22+
private $storeView;
23+
24+
/**
25+
* @param Store $storeView
26+
*/
27+
public function __construct(Store $storeView)
28+
{
29+
$this->storeView = $storeView;
30+
}
31+
32+
/**
33+
* Restore Default Store View.
34+
*
35+
* @return void
36+
*/
37+
public function run()
38+
{
39+
$this->storeView->persist();
40+
}
41+
}

0 commit comments

Comments
 (0)