From f5936db51aa8f8bcefc187701029c708cd77e04f Mon Sep 17 00:00:00 2001 From: Thomas Klein Date: Fri, 11 Jul 2025 12:16:55 +0200 Subject: [PATCH 1/8] Add Store Code to Urls should be Global --- .../Store/Url/Plugin/RouteParamsResolver.php | 71 ++++++------------- 1 file changed, 23 insertions(+), 48 deletions(-) diff --git a/app/code/Magento/Store/Url/Plugin/RouteParamsResolver.php b/app/code/Magento/Store/Url/Plugin/RouteParamsResolver.php index 9c9d1e6023af0..500ff9be3538e 100644 --- a/app/code/Magento/Store/Url/Plugin/RouteParamsResolver.php +++ b/app/code/Magento/Store/Url/Plugin/RouteParamsResolver.php @@ -1,50 +1,35 @@ scopeConfig = $scopeConfig; - $this->storeManager = $storeManager; - $this->queryParamsResolver = $queryParamsResolver; - } + protected ScopeConfigInterface $scopeConfig, + protected StoreManagerInterface $storeManager, + protected QueryParamsResolverInterface $queryParamsResolver + ) {} /** * Process scope query parameters. @@ -56,29 +41,19 @@ public function __construct( * * @return array */ - public function beforeSetRouteParams( - \Magento\Framework\Url\RouteParamsResolver $subject, - array $data, - $unsetOldParams = true - ) { + public function beforeSetRouteParams(RouteParamsResolver $subject, array $data, $unsetOldParams = true) + { if (isset($data['_scope'])) { $subject->setScope($data['_scope']); unset($data['_scope']); } if (isset($data['_scope_to_url']) && (bool)$data['_scope_to_url'] === true) { - /** @var StoreInterface $currentScope */ - $currentScope = $subject->getScope(); - $storeCode = $currentScope && $currentScope instanceof StoreInterface ? - $currentScope->getCode() : - $this->storeManager->getStore()->getCode(); - - $useStoreInUrl = $this->scopeConfig->getValue( - Store::XML_PATH_STORE_IN_URL, - StoreScopeInterface::SCOPE_STORE, - $storeCode - ); - + $useStoreInUrl = $this->scopeConfig->getValue(Store::XML_PATH_STORE_IN_URL); if (!$useStoreInUrl && !$this->storeManager->hasSingleStore()) { + $currentScope = $subject->getScope(); + $storeCode = $currentScope instanceof StoreInterface + ? $currentScope->getCode() + : $this->storeManager->getStore()->getCode(); $this->queryParamsResolver->setQueryParam('___store', $storeCode); } } From 34cb601f8e0c7b6e9b1b1e61989705362fefcd6a Mon Sep 17 00:00:00 2001 From: Thomas Klein Date: Fri, 11 Jul 2025 15:40:18 +0200 Subject: [PATCH 2/8] Fix syntax error --- app/code/Magento/Store/Url/Plugin/RouteParamsResolver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Store/Url/Plugin/RouteParamsResolver.php b/app/code/Magento/Store/Url/Plugin/RouteParamsResolver.php index 500ff9be3538e..f6f6f02e0a260 100644 --- a/app/code/Magento/Store/Url/Plugin/RouteParamsResolver.php +++ b/app/code/Magento/Store/Url/Plugin/RouteParamsResolver.php @@ -10,7 +10,7 @@ use Magento\Framework\Url\QueryParamsResolverInterface; use Magento\Store\Api\Data\StoreInterface; use Magento\Store\Model\ScopeInterface as StoreScopeInterface; -use Magento\Store\Model\StoreManagerInterface +use Magento\Store\Model\StoreManagerInterface; use Magento\Store\Model\Store; /** From 6c94451cde08fbabeb8f028846be7746d3d10c90 Mon Sep 17 00:00:00 2001 From: Thomas Klein Date: Fri, 11 Jul 2025 19:41:48 +0200 Subject: [PATCH 3/8] Fix alias --- app/code/Magento/Store/Url/Plugin/RouteParamsResolver.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Store/Url/Plugin/RouteParamsResolver.php b/app/code/Magento/Store/Url/Plugin/RouteParamsResolver.php index f6f6f02e0a260..2bca667cd7cfd 100644 --- a/app/code/Magento/Store/Url/Plugin/RouteParamsResolver.php +++ b/app/code/Magento/Store/Url/Plugin/RouteParamsResolver.php @@ -6,7 +6,7 @@ namespace Magento\Store\Url\Plugin; use Magento\Framework\App\Config\ScopeConfigInterface; -use Magento\Framework\Url\RouteParamsResolver; +use Magento\Framework\Url\RouteParamsResolver as UrlRouteParamsResolver; use Magento\Framework\Url\QueryParamsResolverInterface; use Magento\Store\Api\Data\StoreInterface; use Magento\Store\Model\ScopeInterface as StoreScopeInterface; @@ -41,7 +41,7 @@ public function __construct( * * @return array */ - public function beforeSetRouteParams(RouteParamsResolver $subject, array $data, $unsetOldParams = true) + public function beforeSetRouteParams(UrlRouteParamsResolver $subject, array $data, $unsetOldParams = true) { if (isset($data['_scope'])) { $subject->setScope($data['_scope']); From 14032171a1e23d5c34f8e7d47c6b3af3b8b298a9 Mon Sep 17 00:00:00 2001 From: Thomas Klein Date: Sun, 13 Jul 2025 14:55:33 +0200 Subject: [PATCH 4/8] Fix tests --- .../Url/Plugin/RouteParamsResolverTest.php | 32 +++++-------------- .../Store/Url/Plugin/RouteParamsResolver.php | 7 ++-- .../Magento/Store/Model/StoreTest.php | 4 +-- 3 files changed, 15 insertions(+), 28 deletions(-) diff --git a/app/code/Magento/Store/Test/Unit/Url/Plugin/RouteParamsResolverTest.php b/app/code/Magento/Store/Test/Unit/Url/Plugin/RouteParamsResolverTest.php index 9c1639b642da5..06f221abad352 100644 --- a/app/code/Magento/Store/Test/Unit/Url/Plugin/RouteParamsResolverTest.php +++ b/app/code/Magento/Store/Test/Unit/Url/Plugin/RouteParamsResolverTest.php @@ -74,12 +74,8 @@ public function testBeforeSetRouteParamsScopeInParams() $this->scopeConfigMock ->expects($this->once()) - ->method('getValue') - ->with( - Store::XML_PATH_STORE_IN_URL, - ScopeInterface::SCOPE_STORE, - $storeCode - ) + ->method('isSetFlag') + ->with(Store::XML_PATH_STORE_IN_URL) ->willReturn(false); $this->storeManagerMock->expects($this->any())->method('hasSingleStore')->willReturn(false); @@ -106,12 +102,8 @@ public function testBeforeSetRouteParamsScopeUseStoreInUrl() $this->scopeConfigMock ->expects($this->once()) - ->method('getValue') - ->with( - Store::XML_PATH_STORE_IN_URL, - ScopeInterface::SCOPE_STORE, - $storeCode - ) + ->method('isSetFlag') + ->with(Store::XML_PATH_STORE_IN_URL) ->willReturn(true); $this->storeManagerMock->expects($this->any())->method('hasSingleStore')->willReturn(false); @@ -139,12 +131,8 @@ public function testBeforeSetRouteParamsSingleStore() $this->scopeConfigMock ->expects($this->once()) - ->method('getValue') - ->with( - Store::XML_PATH_STORE_IN_URL, - ScopeInterface::SCOPE_STORE, - $storeCode - ) + ->method('isSetFlag') + ->with(Store::XML_PATH_STORE_IN_URL) ->willReturn(false); $this->storeManagerMock->expects($this->any())->method('hasSingleStore')->willReturn(true); @@ -171,12 +159,8 @@ public function testBeforeSetRouteParamsNoScopeInParams() $this->scopeConfigMock ->expects($this->once()) - ->method('getValue') - ->with( - Store::XML_PATH_STORE_IN_URL, - ScopeInterface::SCOPE_STORE, - $storeCode - ) + ->method('isSetFlag') + ->with(Store::XML_PATH_STORE_IN_URL) ->willReturn(true); $this->storeManagerMock->expects($this->any())->method('hasSingleStore')->willReturn(false); diff --git a/app/code/Magento/Store/Url/Plugin/RouteParamsResolver.php b/app/code/Magento/Store/Url/Plugin/RouteParamsResolver.php index 2bca667cd7cfd..84a8509454688 100644 --- a/app/code/Magento/Store/Url/Plugin/RouteParamsResolver.php +++ b/app/code/Magento/Store/Url/Plugin/RouteParamsResolver.php @@ -3,6 +3,8 @@ * Copyright 2015 Adobe * All Rights Reserved. */ +declare(strict_types=1); + namespace Magento\Store\Url\Plugin; use Magento\Framework\App\Config\ScopeConfigInterface; @@ -29,7 +31,8 @@ public function __construct( protected ScopeConfigInterface $scopeConfig, protected StoreManagerInterface $storeManager, protected QueryParamsResolverInterface $queryParamsResolver - ) {} + ) { + } /** * Process scope query parameters. @@ -48,7 +51,7 @@ public function beforeSetRouteParams(UrlRouteParamsResolver $subject, array $dat unset($data['_scope']); } if (isset($data['_scope_to_url']) && (bool)$data['_scope_to_url'] === true) { - $useStoreInUrl = $this->scopeConfig->getValue(Store::XML_PATH_STORE_IN_URL); + $useStoreInUrl = $this->scopeConfig->isSetFlag(Store::XML_PATH_STORE_IN_URL); if (!$useStoreInUrl && !$this->storeManager->hasSingleStore()) { $currentScope = $subject->getScope(); $storeCode = $currentScope instanceof StoreInterface diff --git a/dev/tests/integration/testsuite/Magento/Store/Model/StoreTest.php b/dev/tests/integration/testsuite/Magento/Store/Model/StoreTest.php index ba483136898db..08d192db96c1c 100644 --- a/dev/tests/integration/testsuite/Magento/Store/Model/StoreTest.php +++ b/dev/tests/integration/testsuite/Magento/Store/Model/StoreTest.php @@ -294,7 +294,7 @@ public function testGetCurrentUrl() { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $objectManager->get(\Magento\Framework\App\Config\MutableScopeConfigInterface::class) - ->setValue('web/url/use_store', true, ScopeInterface::SCOPE_STORE, 'secondstore'); + ->setValue('web/url/use_store', 1); $this->model->load('admin'); $this->model @@ -346,7 +346,7 @@ public function testGetCurrentUrlWithUseStoreInUrlFalse() { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $objectManager->get(\Magento\Framework\App\Config\ReinitableConfigInterface::class) - ->setValue('web/url/use_store', false, ScopeInterface::SCOPE_STORE, 'default'); + ->setValue('web/url/use_store', 0); /** @var \Magento\Store\Model\Store $secondStore */ $secondStore = $objectManager->get(StoreRepositoryInterface::class)->get('secondstore'); From 8efce477929303322b1ca89050d44fe206414b28 Mon Sep 17 00:00:00 2001 From: Thomas Klein Date: Mon, 14 Jul 2025 22:10:27 +0200 Subject: [PATCH 5/8] use store in url is global --- app/code/Magento/Store/Model/Store.php | 4 ++-- .../Test/Unit/Url/Plugin/RouteParamsResolverTest.php | 9 +++------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/Store/Model/Store.php b/app/code/Magento/Store/Model/Store.php index becdfa8e9e614..05c762cce5164 100644 --- a/app/code/Magento/Store/Model/Store.php +++ b/app/code/Magento/Store/Model/Store.php @@ -764,8 +764,8 @@ protected function _updatePathUseStoreView($url) public function isUseStoreInUrl() { return !($this->hasDisableStoreInUrl() && $this->getDisableStoreInUrl()) - && !$this->getConfig(StoreManager::XML_PATH_SINGLE_STORE_MODE_ENABLED) - && $this->getConfig(self::XML_PATH_STORE_IN_URL); + && !$this->_config->isSetFlag(StoreManager::XML_PATH_SINGLE_STORE_MODE_ENABLED) + && $this->_config->isSetFlag(self::XML_PATH_STORE_IN_URL); } /** diff --git a/app/code/Magento/Store/Test/Unit/Url/Plugin/RouteParamsResolverTest.php b/app/code/Magento/Store/Test/Unit/Url/Plugin/RouteParamsResolverTest.php index 06f221abad352..b9672b8565010 100644 --- a/app/code/Magento/Store/Test/Unit/Url/Plugin/RouteParamsResolverTest.php +++ b/app/code/Magento/Store/Test/Unit/Url/Plugin/RouteParamsResolverTest.php @@ -1,7 +1,7 @@ storeMock->expects($this->any())->method('getCode')->willReturn('custom_store'); $this->storeManagerMock = $this->getMockForAbstractClass(StoreManagerInterface::class); - $this->storeManagerMock - ->expects($this->once()) - ->method('getStore') - ->willReturn($this->storeMock); + $this->storeManagerMock->method('getStore')->willReturn($this->storeMock); $this->queryParamsResolverMock = $this->getMockForAbstractClass(QueryParamsResolverInterface::class); $this->model = new RouteParamsResolver( From 66362b5d63db03da4b40ef70d40e4a63be4b8776 Mon Sep 17 00:00:00 2001 From: Thomas Klein Date: Mon, 14 Jul 2025 22:16:03 +0200 Subject: [PATCH 6/8] use isSet alias --- .../App/Request/StorePathInfoValidator.php | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/app/code/Magento/Store/App/Request/StorePathInfoValidator.php b/app/code/Magento/Store/App/Request/StorePathInfoValidator.php index e22742992d786..0a353813866ac 100644 --- a/app/code/Magento/Store/App/Request/StorePathInfoValidator.php +++ b/app/code/Magento/Store/App/Request/StorePathInfoValidator.php @@ -77,17 +77,16 @@ public function __construct( */ public function getValidStoreCode(Http $request, string $pathInfo = '') : ?string { - $useStoreCodeInUrl = (bool) $this->config->getValue(Store::XML_PATH_STORE_IN_URL); - if (!$useStoreCodeInUrl) { + if (!$this->config->isSetFlag(Store::XML_PATH_STORE_IN_URL)) { return null; } - if (empty($pathInfo)) { + if ($pathInfo === '') { $pathInfo = $this->pathInfo->getPathInfo($request->getRequestUri(), $request->getBaseUrl()); } $storeCode = $this->getStoreCode($pathInfo); - if (empty($storeCode) || $storeCode === Store::ADMIN_CODE || !$this->storeCodeValidator->isValid($storeCode)) { + if ($storeCode === '' || $storeCode === Store::ADMIN_CODE || !$this->storeCodeValidator->isValid($storeCode)) { return null; } @@ -98,14 +97,9 @@ public function getValidStoreCode(Http $request, string $pathInfo = '') : ?strin try { $this->storeRepository->getActiveStoreByCode($storeCode); - $this->validatedStoreCodes[$storeCode] = $storeCode; - return $storeCode; - } catch (NoSuchEntityException $e) { - $this->validatedStoreCodes[$storeCode] = null; - return null; - } catch (StoreIsInactiveException $e) { - $this->validatedStoreCodes[$storeCode] = null; - return null; + return $this->validatedStoreCodes[$storeCode] = $storeCode; + } catch (NoSuchEntityException|StoreIsInactiveException) { + return $this->validatedStoreCodes[$storeCode] = null; } } From c54ef36e02ada77d94c1ba1249ee6cd20518f0fb Mon Sep 17 00:00:00 2001 From: Thomas Klein Date: Tue, 15 Jul 2025 22:50:56 +0200 Subject: [PATCH 7/8] Fix unit tests, static tests, integration tests --- .../Test/Unit/Block/Widget/LinkTest.php | 9 +++++++- .../Request/StorePathInfoValidatorTest.php | 4 ++-- .../Url/Plugin/RouteParamsResolverTest.php | 17 +++++++-------- .../Magento/Store/Model/StoreTest.php | 21 +++++++++---------- 4 files changed, 27 insertions(+), 24 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Unit/Block/Widget/LinkTest.php b/app/code/Magento/Catalog/Test/Unit/Block/Widget/LinkTest.php index aab5685b64a7e..0fbda39ed35d7 100644 --- a/app/code/Magento/Catalog/Test/Unit/Block/Widget/LinkTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Block/Widget/LinkTest.php @@ -195,10 +195,17 @@ public function testStoreCodeShouldBeIncludedInURLOnlyIfItIsConfiguredSo( [ [Store::XML_PATH_USE_REWRITES, ReinitableConfigInterface::SCOPE_TYPE_DEFAULT, null, true], [Store::XML_PATH_UNSECURE_BASE_LINK_URL, ScopeConfigInterface::SCOPE_TYPE_DEFAULT, null, ''], + ] + ); + $config->expects($this->any()) + ->method('isSetFlag') + ->willReturnMap( + [ [ Store::XML_PATH_STORE_IN_URL, ReinitableConfigInterface::SCOPE_TYPE_DEFAULT, - null, $includeStoreCode + null, + $includeStoreCode ] ] ); diff --git a/app/code/Magento/Store/Test/Unit/App/Request/StorePathInfoValidatorTest.php b/app/code/Magento/Store/Test/Unit/App/Request/StorePathInfoValidatorTest.php index 399b1ae184d84..15e3fdc40313c 100644 --- a/app/code/Magento/Store/Test/Unit/App/Request/StorePathInfoValidatorTest.php +++ b/app/code/Magento/Store/Test/Unit/App/Request/StorePathInfoValidatorTest.php @@ -80,7 +80,7 @@ public function testGetValidStoreCodeWithoutStoreInUrl(): void ->willReturn(true); $this->configMock->expects($this->once()) - ->method('getValue') + ->method('isSetFlag') ->with(Store::XML_PATH_STORE_IN_URL) ->willReturn(false); $this->storeRepositoryMock->expects($this->never()) @@ -118,7 +118,7 @@ public function testGetValidStoreCodeWithoutPathInfo(): void public function testGetValidStoreCodeWithEmptyPathInfo(): void { $this->configMock->expects($this->once()) - ->method('getValue') + ->method('isSetFlag') ->with(Store::XML_PATH_STORE_IN_URL) ->willReturn(true); $this->pathInfoMock->expects($this->once()) diff --git a/app/code/Magento/Store/Test/Unit/Url/Plugin/RouteParamsResolverTest.php b/app/code/Magento/Store/Test/Unit/Url/Plugin/RouteParamsResolverTest.php index b9672b8565010..691e0282881fb 100644 --- a/app/code/Magento/Store/Test/Unit/Url/Plugin/RouteParamsResolverTest.php +++ b/app/code/Magento/Store/Test/Unit/Url/Plugin/RouteParamsResolverTest.php @@ -103,7 +103,7 @@ public function testBeforeSetRouteParamsScopeUseStoreInUrl() ->with(Store::XML_PATH_STORE_IN_URL) ->willReturn(true); - $this->storeManagerMock->expects($this->any())->method('hasSingleStore')->willReturn(false); + $this->storeManagerMock->expects($this->never())->method('hasSingleStore'); /** @var MockObject $routeParamsResolverMock */ $routeParamsResolverMock = $this->getMockBuilder(\Magento\Framework\Url\RouteParamsResolver::class) @@ -111,14 +111,11 @@ public function testBeforeSetRouteParamsScopeUseStoreInUrl() ->disableOriginalConstructor() ->getMock(); $routeParamsResolverMock->expects($this->once())->method('setScope')->with($storeCode); - $routeParamsResolverMock->expects($this->once())->method('getScope')->willReturn($storeCode); + $routeParamsResolverMock->expects($this->never())->method('getScope'); $this->queryParamsResolverMock->expects($this->never())->method('setQueryParam')->with('___store', $storeCode); - $this->model->beforeSetRouteParams( - $routeParamsResolverMock, - $data - ); + $this->model->beforeSetRouteParams($routeParamsResolverMock, $data); } public function testBeforeSetRouteParamsSingleStore() @@ -131,7 +128,7 @@ public function testBeforeSetRouteParamsSingleStore() ->method('isSetFlag') ->with(Store::XML_PATH_STORE_IN_URL) ->willReturn(false); - $this->storeManagerMock->expects($this->any())->method('hasSingleStore')->willReturn(true); + $this->storeManagerMock->expects($this->once())->method('hasSingleStore')->willReturn(true); /** @var MockObject $routeParamsResolverMock */ $routeParamsResolverMock = $this->getMockBuilder(\Magento\Framework\Url\RouteParamsResolver::class) @@ -139,7 +136,7 @@ public function testBeforeSetRouteParamsSingleStore() ->disableOriginalConstructor() ->getMock(); $routeParamsResolverMock->expects($this->once())->method('setScope')->with($storeCode); - $routeParamsResolverMock->expects($this->once())->method('getScope')->willReturn($storeCode); + $routeParamsResolverMock->expects($this->never())->method('getScope'); $this->queryParamsResolverMock->expects($this->never())->method('setQueryParam'); @@ -160,7 +157,7 @@ public function testBeforeSetRouteParamsNoScopeInParams() ->with(Store::XML_PATH_STORE_IN_URL) ->willReturn(true); - $this->storeManagerMock->expects($this->any())->method('hasSingleStore')->willReturn(false); + $this->storeManagerMock->expects($this->never())->method('hasSingleStore'); /** @var MockObject $routeParamsResolverMock */ $routeParamsResolverMock = $this->getMockBuilder(\Magento\Framework\Url\RouteParamsResolver::class) @@ -168,7 +165,7 @@ public function testBeforeSetRouteParamsNoScopeInParams() ->disableOriginalConstructor() ->getMock(); $routeParamsResolverMock->expects($this->never())->method('setScope'); - $routeParamsResolverMock->expects($this->once())->method('getScope')->willReturn(false); + $routeParamsResolverMock->expects($this->never())->method('getScope'); $this->queryParamsResolverMock->expects($this->never())->method('setQueryParam')->with('___store', $storeCode); diff --git a/dev/tests/integration/testsuite/Magento/Store/Model/StoreTest.php b/dev/tests/integration/testsuite/Magento/Store/Model/StoreTest.php index 08d192db96c1c..0e14c830d4def 100644 --- a/dev/tests/integration/testsuite/Magento/Store/Model/StoreTest.php +++ b/dev/tests/integration/testsuite/Magento/Store/Model/StoreTest.php @@ -1,8 +1,9 @@ get(\Magento\Framework\App\Config\MutableScopeConfigInterface::class) - ->setValue(Store::XML_PATH_STORE_IN_URL, $useStoreCode, ScopeInterface::SCOPE_STORE); + ->setValue(Store::XML_PATH_STORE_IN_URL, $useStoreCode); $actual = $this->model->getBaseUrl($type); $this->assertEquals($expected, $actual); @@ -220,7 +221,7 @@ public function testGetBaseUrlForCustomEntryPoint($type, $useCustomEntryPoint, $ \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->get(\Magento\Framework\App\Config\MutableScopeConfigInterface::class) - ->setValue(Store::XML_PATH_STORE_IN_URL, $useStoreCode, ScopeInterface::SCOPE_STORE); + ->setValue(Store::XML_PATH_STORE_IN_URL, $useStoreCode); // emulate custom entry point $_SERVER['SCRIPT_FILENAME'] = 'custom_entry.php'; @@ -461,14 +462,12 @@ public function testIsUseStoreInUrl($storeInUrl, $disableStoreInUrl, $singleStor ->create(\Magento\Framework\Model\Context::class, ['appState' => $appStateMock]); $configMock - ->method('getValue') + ->method('isSetFlag') ->willReturnCallback( - function ($arg1) use ($singleStoreModeEnabled, $storeInUrl) { - if ($arg1 == StoreManager::XML_PATH_SINGLE_STORE_MODE_ENABLED) { - return $singleStoreModeEnabled; - } elseif ($arg1 == Store::XML_PATH_STORE_IN_URL) { - return $storeInUrl; - } + static fn($arg1) => match ($arg1) { + StoreManager::XML_PATH_SINGLE_STORE_MODE_ENABLED => $singleStoreModeEnabled, + Store::XML_PATH_STORE_IN_URL => $storeInUrl, + default => null } ); From 77594ebeef2fa09acc88750e8beddb687ee2175a Mon Sep 17 00:00:00 2001 From: Thomas Klein Date: Wed, 16 Jul 2025 11:39:38 +0200 Subject: [PATCH 8/8] Fix unit tests, use isSetFlag instead of getValue --- .../Test/Unit/App/Request/StorePathInfoValidatorTest.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Store/Test/Unit/App/Request/StorePathInfoValidatorTest.php b/app/code/Magento/Store/Test/Unit/App/Request/StorePathInfoValidatorTest.php index 15e3fdc40313c..a2ecbc101bf95 100644 --- a/app/code/Magento/Store/Test/Unit/App/Request/StorePathInfoValidatorTest.php +++ b/app/code/Magento/Store/Test/Unit/App/Request/StorePathInfoValidatorTest.php @@ -95,7 +95,7 @@ public function testGetValidStoreCodeWithoutPathInfo(): void $storeCode = 'store1'; $this->configMock->expects($this->once()) - ->method('getValue') + ->method('isSetFlag') ->with(Store::XML_PATH_STORE_IN_URL) ->willReturn(true); $this->pathInfoMock->expects($this->once()) @@ -139,7 +139,7 @@ public function testGetValidStoreCodeWithEmptyPathInfo(): void */ public function testGetValidStoreCodeThrowsException(\Throwable $exception): void { - $this->configMock->method('getValue') + $this->configMock->method('isSetFlag') ->with(Store::XML_PATH_STORE_IN_URL) ->willReturn(true); $this->storeCodeValidatorMock->method('isValid') @@ -169,7 +169,7 @@ public static function getValidStoreCodeExceptionDataProvider(): array */ public function testGetValidStoreCode(string $pathInfo, bool $isStoreCodeValid, ?string $expectedResult): void { - $this->configMock->method('getValue') + $this->configMock->method('isSetFlag') ->with(Store::XML_PATH_STORE_IN_URL) ->willReturn(true); $this->pathInfoMock->method('getPathInfo') @@ -195,7 +195,7 @@ public function testGetValidStoreCodeResultIsCached( bool $isStoreCodeValid, ?string $expectedResult ): void { - $this->configMock->method('getValue') + $this->configMock->method('isSetFlag') ->with(Store::XML_PATH_STORE_IN_URL) ->willReturn(true); $this->pathInfoMock->method('getPathInfo')