File tree Expand file tree Collapse file tree 2 files changed +56
-1
lines changed
app/code/Magento/Backend/App/Area
dev/tests/integration/testsuite/Magento/Backend/App/Area Expand file tree Collapse file tree 2 files changed +56
-1
lines changed Original file line number Diff line number Diff line change @@ -123,7 +123,13 @@ public function isHostBackend()
123
123
if ($ this ->scopeConfig ->getValue (self ::XML_PATH_USE_CUSTOM_ADMIN_URL , ScopeInterface::SCOPE_STORE )) {
124
124
$ backendUrl = $ this ->scopeConfig ->getValue (self ::XML_PATH_CUSTOM_ADMIN_URL , ScopeInterface::SCOPE_STORE );
125
125
} else {
126
- $ backendUrl = $ this ->scopeConfig ->getValue (Store::XML_PATH_UNSECURE_BASE_URL , ScopeInterface::SCOPE_STORE );
126
+ $ backendUrl = $ this ->config ->getValue (Store::XML_PATH_UNSECURE_BASE_URL );
127
+ if ($ backendUrl === null ) {
128
+ $ backendUrl = $ this ->scopeConfig ->getValue (
129
+ Store::XML_PATH_UNSECURE_BASE_URL ,
130
+ ScopeInterface::SCOPE_STORE
131
+ );
132
+ }
127
133
}
128
134
$ host = $ this ->request ->getServer ('HTTP_HOST ' , '' );
129
135
return stripos ($ this ->getHostWithPort ($ backendUrl ), (string ) $ host ) !== false ;
Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © Magento, Inc. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+
7
+ declare (strict_types=1 );
8
+
9
+ namespace Magento \Backend \App \Area ;
10
+
11
+ use PHPUnit \Framework \TestCase ;
12
+ use Magento \TestFramework \Helper \Bootstrap ;
13
+
14
+ /**
15
+ * @magentoAppArea adminhtml
16
+ */
17
+ class FrontNameResolverTest extends TestCase
18
+ {
19
+ /**
20
+ * @var \Magento\Framework\ObjectManagerInterface
21
+ */
22
+ protected $ objectManager ;
23
+
24
+ /**
25
+ * @var FrontNameResolver
26
+ */
27
+ protected $ model ;
28
+
29
+ /**
30
+ * @inheritDoc
31
+ */
32
+ protected function setUp (): void
33
+ {
34
+ $ this ->objectManager = Bootstrap::getObjectManager ();
35
+ $ this ->model = $ this ->objectManager ->create (
36
+ FrontNameResolver::class
37
+ );
38
+ $ _SERVER ['HTTP_HOST ' ] = 'localhost ' ;
39
+ }
40
+
41
+ /**
42
+ * @magentoDbIsolation enabled
43
+ * @magentoConfigFixture current_store web/unsecure/base_url http://example.com/
44
+ */
45
+ public function testIsHostBackend ()
46
+ {
47
+ $ this ->assertTrue ($ this ->model ->isHostBackend ());
48
+ }
49
+ }
You can’t perform that action at this time.
0 commit comments