35 $this->coreConfig = $this->getMockForAbstractClass(
36 \
Magento\Framework\
App\Config\ScopeConfigInterface::class,
41 $this->backendConfig = $this->getMockForAbstractClass(
47 $this->url = $this->getMockForAbstractClass(
48 \
Magento\Framework\UrlInterface::class,
56 $this->adminPathConfig =
new AdminPathConfig($this->coreConfig, $this->backendConfig, $this->url);
61 $request = $this->getMockForAbstractClass(
62 \
Magento\Framework\
App\RequestInterface::class,
70 $request->expects($this->once())->method(
'getPathInfo')->willReturn(
'/info');
71 $this->url->expects($this->once())->method(
'getBaseUrl')->with(
'link',
true)->willReturn(
'localhost/');
72 $this->assertEquals(
'localhost/info', $this->adminPathConfig->getCurrentSecureUrl(
$request));
82 public function testShouldBeSecure($unsecureBaseUrl, $useSecureInAdmin, $secureBaseUrl, $expected)
84 $coreConfigValueMap = [
88 $this->coreConfig->expects($this->any())->method(
'getValue')->will($this->returnValueMap($coreConfigValueMap));
89 $this->backendConfig->expects($this->any())->method(
'isSetFlag')->willReturn($useSecureInAdmin);
90 $this->assertEquals($expected, $this->adminPathConfig->shouldBeSecure(
''));
99 [
'http://localhost/',
false,
'default',
false],
100 [
'http://localhost/',
true,
'default',
false],
101 [
'https://localhost/',
false,
'default',
true],
102 [
'https://localhost/',
true,
'default',
true],
103 [
'http://localhost/',
false,
'https://localhost/',
false],
104 [
'http://localhost/',
true,
'https://localhost/',
true],
105 [
'https://localhost/',
true,
'https://localhost/',
true],
111 $this->backendConfig->expects($this->once())
113 ->with(
'web/default/admin')
114 ->willReturn(
'default/path');
115 $this->assertEquals(
'default/path', $this->adminPathConfig->getDefaultPath());
const XML_PATH_UNSECURE_BASE_URL
shouldBeSecureDataProvider()
testShouldBeSecure($unsecureBaseUrl, $useSecureInAdmin, $secureBaseUrl, $expected)
const XML_PATH_SECURE_BASE_URL
testGetCurrentSecureUrl()