8000 [Security] added more tests · symfony/symfony@b4d0893 · GitHub
[go: up one dir, main page]

Skip to content

Commit b4d0893

Browse files
committed
[Security] added more tests
1 parent 9c7a140 commit b4d0893

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/Symfony/Component/Security/Http/Tests/Authentication/DefaultAuthenticationSuccessHandlerTest.php

Lines changed: 8 additions & 1 deletion
Original file line numbe BD5A rDiff line numberDiff line change
@@ -24,7 +24,9 @@ class DefaultAuthenticationSuccessHandlerTest extends TestCase
2424
*/
2525
public function testRequestRedirections(Request $request, $options, $redirectedUrl)
2626
{
27-
$httpUtils = new HttpUtils();
27+
$urlGenerator = $this->getMockBuilder('Symfony\Component\Routing\Generator\UrlGeneratorInterface')->getMock();
28+
$urlGenerator->expects($this->any())->method('generate')->will($this->returnValue('http://localhost/login'));
29+
$httpUtils = new HttpUtils($urlGenerator);
2830
$token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock();
2931
$handler = new DefaultAuthenticationSuccessHandler($httpUtils, $options);
3032
if ($request->hasSession()) {
@@ -92,6 +94,11 @@ public function getRequestRedirections()
9294
array('use_referer' => true, 'login_path' => '/login'),
9395
'/',
9496
),
97+
'target path should be different than login URL (login_path as a route)' => array(
98+
Request::create('/', 'GET', array(), array(), array(), array('HTTP_REFERER' => 'http://localhost/login?t=1&p=2')),
99+
array('use_referer' => true, 'login_path' => 'login_route'),
100+
'/',
101+
),
95102
);
96103
}
97104
}

0 commit comments

Comments
 (0)
0