@@ -137,7 +137,7 @@ public function testTargetPathIsPassedAsReferer()
137
137
$ this ->assertSame ($ response , $ result );
138
138
}
139
139
140
- public function testRefererHasToBeDifferentThatLoginUrl ()
140
+ public function testRefererHasToBeDifferentThanLoginUrl ()
141
141
{
142
142
$ options = array ('use_referer ' => true );
143
143
@@ -157,6 +157,26 @@ public function testRefererHasToBeDifferentThatLoginUrl()
157
157
$ this ->assertSame ($ response , $ result );
158
158
}
159
159
160
+ public function testRefererWithoutParametersHasToBeDifferentThanLoginUrl ()
161
+ {
162
+ $ options = array ('use_referer ' => true );
163
+
164
+ $ this ->request ->headers ->expects ($ this ->any ())
165
+ ->method ('get ' )->with ('Referer ' )
166
+ ->will ($ this ->returnValue ('/subfolder/login?t=1&p=2 ' ));
167
+
168
+ $ this ->httpUtils ->expects ($ this ->once ())
169
+ ->method ('generateUri ' )->with ($ this ->request , '/login ' )
170
+ ->will ($ this ->returnValue ('/subfolder/login ' ));
171
+
172
+ $ response = $ this ->expectRedirectResponse ('/ ' );
173
+
174
+ $ handler = new DefaultAuthenticationSuccessHandler ($ this ->httpUtils , $ options );
175
+ $ result = $ handler ->onAuthenticationSuccess ($ this ->request , $ this ->token );
176
+
177
+ $ this ->assertSame ($ response , $ result );
178
+ }
179
+
160
180
public function testRefererTargetPathIsIgnoredByDefault ()
161
181
{
162
182
$ this ->request ->headers ->expects ($ this ->never ())->method ('get ' );
0 commit comments