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