@@ -76,17 +76,35 @@ public function testGetCurrentSecureUrl()
76
76
* @param $unsecureBaseUrl
77
77
* @param $useSecureInAdmin
78
78
* @param $secureBaseUrl
79
+ * @param $useCustomUrl
80
+ * @param $customUrl
79
81
* @param $expected
80
82
* @dataProvider shouldBeSecureDataProvider
81
83
*/
82
- public function testShouldBeSecure ($ unsecureBaseUrl , $ useSecureInAdmin , $ secureBaseUrl , $ expected )
83
- {
84
- $ coreConfigValueMap = [
84
+ public function testShouldBeSecure (
85
+ $ unsecureBaseUrl ,
86
+ $ useSecureInAdmin ,
87
+ $ secureBaseUrl ,
88
+ $ useCustomUrl ,
89
+ $ customUrl ,
90
+ $ expected
91
+ ) {
92
+ $ coreConfigValueMap = $ this ->returnValueMap ([
85
93
[\Magento \Store \Model \Store::XML_PATH_UNSECURE_BASE_URL , 'default ' , null , $ unsecureBaseUrl ],
86
94
[\Magento \Store \Model \Store::XML_PATH_SECURE_BASE_URL , 'default ' , null , $ secureBaseUrl ],
87
- ];
88
- $ this ->coreConfig ->expects ($ this ->any ())->method ('getValue ' )->will ($ this ->returnValueMap ($ coreConfigValueMap ));
89
- $ this ->backendConfig ->expects ($ this ->any ())->method ('isSetFlag ' )->willReturn ($ useSecureInAdmin );
95
+ ['admin/url/custom ' , 'default ' , null , $ customUrl ],
96
+ ]);
97
+ $ backendConfigFlagsMap = $ this ->returnValueMap ([
98
+ [\Magento \Store \Model \Store::XML_PATH_SECURE_IN_ADMINHTML , $ useSecureInAdmin ],
99
+ ['admin/url/use_custom ' , $ useCustomUrl ],
100
+ ]);
101
+ $ this ->coreConfig ->expects ($ this ->atLeast (1 ))->method ('getValue ' )
102
+ ->will ($ coreConfigValueMap );
103
+ $ this ->coreConfig ->expects ($ this ->atMost (2 ))->method ('getValue ' )
104
+ ->will ($ coreConfigValueMap );
105
+
106
+ $ this ->backendConfig ->expects ($ this ->atMost (2 ))->method ('isSetFlag ' )
107
+ ->will ($ backendConfigFlagsMap );
90
108
$ this ->assertEquals ($ expected , $ this ->adminPathConfig ->shouldBeSecure ('' ));
91
109
}
92
110
@@ -96,13 +114,13 @@ public function testShouldBeSecure($unsecureBaseUrl, $useSecureInAdmin, $secureB
96
114
public function shouldBeSecureDataProvider ()
97
115
{
98
116
return [
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 ],
117
+ ['http://localhost/ ' , false , 'default ' , false , '' , false ],
118
+ ['http://localhost/ ' , true , 'default ' , false , '' , false ],
119
+ ['https://localhost/ ' , false , 'default ' , false , '' , true ],
120
+ ['https://localhost/ ' , true , 'default ' , false , '' , true ],
121
+ ['http://localhost/ ' , false , 'https://localhost/ ' , false , '' , false ],
122
+ ['http://localhost/ ' , true , 'https://localhost/ ' , false , '' , true ],
123
+ ['https://localhost/ ' , true , 'https://localhost/ ' , false , '' , true ],
106
124
];
107
125
}
108
126
0 commit comments