Skip to content

Commit

Permalink
MAGETWO-60746: [GITHUB] Edit default store view will stop saying that…
Browse files Browse the repository at this point in the history
… Default store cannot be disabled #7349

- Add functional test
  • Loading branch information
vgoncharenko committed Apr 7, 2017
1 parent b4035b5 commit 12a4d00
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Magento\Backend\Test\Page\Adminhtml\StoreIndex;
use Magento\Store\Test\Fixture\Store;
use Magento\Mtf\TestCase\Injectable;
use Magento\Store\Test\TestStep\RestoreDefaultStoreViewStep;

/**
* Test Creation for UpdateStoreEntity (Store Management)
Expand Down Expand Up @@ -50,17 +51,36 @@ class UpdateStoreEntityTest extends Injectable
*/
protected $editStore;

/**
* Restore Default Store View step.
*
* @var RestoreDefaultStoreViewStep
*/
private $restoreDefaultStoreViewStep;

/**
* Initial store fixture.
*
* @var Store
*/
private $storeInitial;

/**
* Preparing pages for test
*
* @param StoreIndex $storeIndex
* @param EditStore $editStore
* @param RestoreDefaultStoreViewStep $restoreDefaultStoreViewStep
* @return void
*/
public function __inject(StoreIndex $storeIndex, EditStore $editStore)
{
public function __inject(
StoreIndex $storeIndex,
EditStore $editStore,
RestoreDefaultStoreViewStep $restoreDefaultStoreViewStep
) {
$this->storeIndex = $storeIndex;
$this->editStore = $editStore;
$this->restoreDefaultStoreViewStep = $restoreDefaultStoreViewStep;
}

/**
Expand All @@ -73,6 +93,7 @@ public function __inject(StoreIndex $storeIndex, EditStore $editStore)
public function test(Store $storeInitial, Store $store)
{
// Preconditions:
$this->storeInitial = $storeInitial;
$storeInitial->persist();

// Steps:
Expand All @@ -81,4 +102,14 @@ public function test(Store $storeInitial, Store $store)
$this->editStore->getStoreForm()->fill($store);
$this->editStore->getFormPageActions()->save();
}

/**
* {@inheritdoc}
*/
public function tearDown()
{
if($this->storeInitial->getCode() == 'default') {
$this->restoreDefaultStoreViewStep->run();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,11 @@
<constraint name="Magento\Store\Test\Constraint\AssertStoreBackend" />
<constraint name="Magento\Store\Test\Constraint\AssertStoreFrontend" />
</variation>
<variation name="UpdateStoreEntityTestVariation2">
<data name="tag" xsi:type="string">severity:S1</data>
<data name="storeInitial/dataset" xsi:type="string">default</data>
<data name="store/data/name" xsi:type="string">storename_updated%isolation%</data>
<constraint name="Magento\Store\Test\Constraint\AssertStoreSuccessSaveMessage" />
</variation>
</testCase>
</config>
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\Store\Test\TestStep;

use Magento\Mtf\TestStep\TestStepInterface;
use Magento\Store\Test\Fixture\Store;

/**
* Restore DefaultStore view.
*/
class RestoreDefaultStoreViewStep implements TestStepInterface
{
/**
* Fixture of Store View.
*
* @var Store
*/
private $storeView;

/**
* @param Store $storeView
*/
public function __construct(Store $storeView)
{
$this->storeView = $storeView;
}

/**
* Restore Default Store View.
*
* @return void
*/
public function run()
{
$this->storeView->persist();
}
}

0 comments on commit 12a4d00

Please sign in to comment.