Skip to content

Commit e59cc20

Browse files
committed
Merge remote-tracking branch '36414/patch-2' into comm_78764_31355
2 parents e22aa46 + 5815e8d commit e59cc20

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

app/code/Magento/Store/Model/Store.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
use Magento\Framework\Url\ScopeInterface as UrlScopeInterface;
2222
use Magento\Framework\UrlInterface;
2323
use Magento\Store\Api\Data\StoreInterface;
24+
use Magento\Store\Model\StoreManager;
2425

2526
/**
2627
* Store model
@@ -760,6 +761,7 @@ protected function _updatePathUseStoreView($url)
760761
public function isUseStoreInUrl()
761762
{
762763
return !($this->hasDisableStoreInUrl() && $this->getDisableStoreInUrl())
764+
&& !$this->getConfig(StoreManager::XML_PATH_SINGLE_STORE_MODE_ENABLED)
763765
&& $this->getConfig(self::XML_PATH_STORE_IN_URL);
764766
}
765767

dev/tests/integration/testsuite/Magento/Store/Model/StoreTest.php

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -446,10 +446,11 @@ public function saveValidationDataProvider()
446446
/**
447447
* @param $storeInUrl
448448
* @param $disableStoreInUrl
449+
* @param $singleStoreModeEnabled
449450
* @param $expectedResult
450451
* @dataProvider isUseStoreInUrlDataProvider
451452
*/
452-
public function testIsUseStoreInUrl($storeInUrl, $disableStoreInUrl, $expectedResult)
453+
public function testIsUseStoreInUrl($storeInUrl, $disableStoreInUrl, $singleStoreModeEnabled, $expectedResult)
453454
{
454455
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
455456
$configMock = $this->createMock(\Magento\Framework\App\Config\ReinitableConfigInterface::class);
@@ -459,10 +460,13 @@ public function testIsUseStoreInUrl($storeInUrl, $disableStoreInUrl, $expectedRe
459460
$params['context'] = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
460461
->create(\Magento\Framework\Model\Context::class, ['appState' => $appStateMock]);
461462

462-
$configMock->expects($this->any())
463+
$configMock
463464
->method('getValue')
464-
->with($this->stringContains(Store::XML_PATH_STORE_IN_URL))
465-
->willReturn($storeInUrl);
465+
->withConsecutive(
466+
[$this->stringContains(StoreManager::XML_PATH_SINGLE_STORE_MODE_ENABLED)],
467+
[$this->stringContains(Store::XML_PATH_STORE_IN_URL)]
468+
)
469+
->willReturnOnConsecutiveCalls($singleStoreModeEnabled, $storeInUrl);
466470

467471
$params['config'] = $configMock;
468472
$model = $objectManager->create(\Magento\Store\Model\Store::class, $params);
@@ -477,10 +481,14 @@ public function testIsUseStoreInUrl($storeInUrl, $disableStoreInUrl, $expectedRe
477481
public function isUseStoreInUrlDataProvider()
478482
{
479483
return [
480-
[true, null, true],
481-
[false, null, false],
482-
[true, true, false],
483-
[true, false, true]
484+
[true, null, false, true],
485+
[false, null, false, false],
486+
[true, true, false, false],
487+
[true, false, false, true],
488+
[true, null, true, false],
489+
[false, null, true, false],
490+
[true, true, true, false],
491+
[true, false, true, false]
484492
];
485493
}
486494

0 commit comments

Comments
 (0)