File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -84,6 +84,7 @@ public function __construct(
84
84
$ adminPath = $ this ->extractAdminPath ();
85
85
$ this ->setCookiePath ($ adminPath );
86
86
$ this ->setName ($ sessionName );
87
+ $ this ->setCookieSecure ($ this ->_httpRequest ->isSecure ());
87
88
}
88
89
89
90
/**
Original file line number Diff line number Diff line change @@ -105,12 +105,14 @@ public function testSetCookiePathNonDefault()
105
105
}
106
106
107
107
/**
108
- * Test for setting session name for admin
109
- *
108
+ * Test for setting session name and secure_cookie for admin
109
+ * @dataProvider requestSecureDataProvider
110
+ * @param $secureRequest
110
111
*/
111
- public function testSetSessionNameByConstructor ( )
112
+ public function testSetSessionSettingsByConstructor ( $ secureRequest )
112
113
{
113
114
$ sessionName = 'admin ' ;
115
+ $ this ->requestMock ->expects ($ this ->once ())->method ('isSecure ' )->willReturn ($ secureRequest );
114
116
115
117
$ validatorMock = $ this ->getMockBuilder ('Magento\Framework\Validator\ValidatorInterface ' )
116
118
->disableOriginalConstructor ()
@@ -136,5 +138,11 @@ public function testSetSessionNameByConstructor()
136
138
]
137
139
);
138
140
$ this ->assertSame ($ sessionName , $ adminConfig ->getName ());
141
+ $ this ->assertSame ($ secureRequest , $ adminConfig ->getCookieSecure ());
142
+ }
143
+
144
+ public function requestSecureDataProvider ()
145
+ {
146
+ return [[true ], [false ]];
139
147
}
140
148
}
You can’t perform that action at this time.
0 commit comments