Skip to content

Commit

Permalink
Improve code, DEV-362
Browse files Browse the repository at this point in the history
  • Loading branch information
RanaMuhammadIrshad committed Jun 5, 2024
1 parent bfe00d9 commit c075dad
Showing 1 changed file with 57 additions and 60 deletions.
117 changes: 57 additions & 60 deletions Test/Integration/CheckDefaultStoreCodeHiddenInUrlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,70 +11,67 @@
use Magento\TestFramework\Helper\Bootstrap;
use Magento\TestFramework\TestCase\AbstractController;

if (class_exists('Magento\TestFramework\TestCase\AbstractController')) {
class CheckDefaultStoreCodeHiddenInUrlTest extends AbstractController
{
/**
* @var StoreRepositoryInterface
*/
protected $storeRepository;

class CheckDefaultStoreCodeHiddenInUrlTest extends AbstractController
{
/**
* @var StoreRepositoryInterface
*/
protected $storeRepository;

/**
* @var ReinitableConfigInterface
*/
protected $config;
/**
* @var ReinitableConfigInterface
*/
protected $config;

protected function setUp(): void
{
parent::setUp();
$objectManager = Bootstrap::getObjectManager();
$this->config = $objectManager->get(ReinitableConfigInterface::class);
$this->storeRepository = $objectManager->get(StoreRepositoryInterface::class);
}
protected function setUp(): void
{
parent::setUp();
$objectManager = Bootstrap::getObjectManager();
$this->config = $objectManager->get(ReinitableConfigInterface::class);
$this->storeRepository = $objectManager->get(StoreRepositoryInterface::class);
}

/**
* @magentoDataFixture Magento/Store/_files/store.php
*/
public function testStoreCodeIsShownInNonDefaultStoreUrl(): void
{
$store = $this->storeRepository->get('test');
$this->config->setValue(Store::XML_PATH_STORE_IN_URL, true, ScopeInterface::SCOPE_STORE, $store->getCode());
$this->assertStringContainsString('test', $store->getBaseUrl());
}
/**
* @magentoDataFixture Magento/Store/_files/store.php
*/
public function testStoreCodeIsShownInNonDefaultStoreUrl(): void
{
$store = $this->storeRepository->get('test');
$this->config->setValue(Store::XML_PATH_STORE_IN_URL, true, ScopeInterface::SCOPE_STORE, $store->getCode());
$this->assertStringContainsString('test', $store->getBaseUrl());
}

/**
* @magentoDataFixture Magento/Store/_files/store.php
*/
public function testStoreCodeIsNotShownInNonDefaultStoreUrl(): void
{
$store = $this->storeRepository->get('test');
$this->config->setValue(
Store::XML_PATH_STORE_IN_URL,
false,
ScopeInterface::SCOPE_STORE,
$store->getCode()
);
$this->assertStringNotContainsString('test', $store->getBaseUrl());
}
/**
* @magentoDataFixture Magento/Store/_files/store.php
*/
public function testStoreCodeIsNotShownInNonDefaultStoreUrl(): void
{
$store = $this->storeRepository->get('test');
$this->config->setValue(
Store::XML_PATH_STORE_IN_URL,
false,
ScopeInterface::SCOPE_STORE,
$store->getCode()
);
$this->assertStringNotContainsString('test', $store->getBaseUrl());
}

public function testStoreCodeIsNotShownInDefaultStoreUrl(): void
{
$store = $this->storeRepository->get('default');
$this->config->setValue(
Store::XML_PATH_STORE_IN_URL,
false,
ScopeInterface::SCOPE_STORE,
$store->getCode()
);
$this->assertStringNotContainsString('default', $store->getBaseUrl());
}
public function testStoreCodeIsNotShownInDefaultStoreUrl(): void
{
$store = $this->storeRepository->get('default');
$this->config->setValue(
Store::XML_PATH_STORE_IN_URL,
false,
ScopeInterface::SCOPE_STORE,
$store->getCode()
);
$this->assertStringNotContainsString('default', $store->getBaseUrl());
}

public function testStoreCodeIsShownInDefaultStoreUrl(): void
{
$store = $this->storeRepository->get('default');
$this->config->setValue(Store::XML_PATH_STORE_IN_URL, true, ScopeInterface::SCOPE_STORE, $store->getCode());
$this->assertStringNotContainsString('default', $store->getBaseUrl());
}
public function testStoreCodeIsShownInDefaultStoreUrl(): void
{
$store = $this->storeRepository->get('default');
$this->config->setValue(Store::XML_PATH_STORE_IN_URL, true, ScopeInterface::SCOPE_STORE, $store->getCode());
$this->assertStringNotContainsString('default', $store->getBaseUrl());
}
}
}

0 comments on commit c075dad

Please sign in to comment.