-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3735 from magento-mpi/port-97898
Fixed issues: - [MAGETWO-97898](https://jira.corp.magento.com/browse/MAGETWO-97898) [Magento Cloud] Store switcher URL redirects to the same store
- Loading branch information
Showing
2 changed files
with
66 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
dev/tests/integration/testsuite/Magento/Store/Model/StoreResolver/WebsiteTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\Store\Model\StoreResolver; | ||
|
||
use Magento\TestFramework\Helper\Bootstrap; | ||
|
||
class WebsiteTest extends \PHPUnit\Framework\TestCase | ||
{ | ||
/** | ||
* @var Website | ||
*/ | ||
private $reader; | ||
|
||
protected function setUp() | ||
{ | ||
$this->reader = Bootstrap::getObjectManager()->create(Website::class); | ||
} | ||
|
||
/** | ||
* Tests retrieving of stores id by passed scope. | ||
* | ||
* @param string|null $scopeCode website code | ||
* @param int $storesCount | ||
* @magentoDataFixture Magento/Store/_files/second_website_with_two_stores.php | ||
* @magentoDbIsolation disabled | ||
* @magentoAppIsolation enabled | ||
* @dataProvider scopeDataProvider | ||
*/ | ||
public function testGetAllowedStoreIds($scopeCode, $storesCount) | ||
{ | ||
$this->assertCount($storesCount, $this->reader->getAllowedStoreIds($scopeCode)); | ||
} | ||
|
||
/** | ||
* Provides scopes and corresponding count of resolved stores. | ||
* | ||
* @return array | ||
*/ | ||
public function scopeDataProvider(): array | ||
{ | ||
return [ | ||
[null, 4], | ||
['test', 2] | ||
]; | ||
} | ||
|
||
/** | ||
* Tests retrieving of stores id by passing incorrect scope. | ||
* | ||
* @expectedException \Magento\Framework\Exception\NoSuchEntityException | ||
* @expectedExceptionMessage The website with code not_exists that was requested wasn't found. | ||
*/ | ||
public function testIncorrectScope() | ||
{ | ||
$this->reader->getAllowedStoreIds('not_exists'); | ||
} | ||
} |