@@ -19,12 +19,15 @@ class CsrfFormLoginTest extends AbstractWebTestCase
1919 public function testFormLoginAndLogoutWithCsrfTokens ($ config )
2020 {
2121 $ client = $ this ->createClient (['test_case ' => 'CsrfFormLogin ' , 'root_config ' => $ config ]);
22+ static ::$ container ->get ('security.csrf.token_storage ' )->setToken ('foo ' , 'bar ' );
2223
2324 $ form = $ client ->request ('GET ' , '/login ' )->selectButton ('login ' )->form ();
2425 $ form ['user_login[username] ' ] = 'johannes ' ;
2526 $ form ['user_login[password] ' ] = 'test ' ;
2627 $ client ->submit ($ form );
2728
29+ $ this ->assertFalse (static ::$ container ->get ('security.csrf.token_storage ' )->hasToken ('foo ' ));
30+
2831 $ this ->assertRedirect ($ client ->getResponse (), '/profile ' );
2932
3033 $ crawler = $ client ->followRedirect ();
@@ -48,11 +51,14 @@ public function testFormLoginAndLogoutWithCsrfTokens($config)
4851 public function testFormLoginWithInvalidCsrfToken ($ config )
4952 {
5053 $ client = $ this ->createClient (['test_case ' => 'CsrfFormLogin ' , 'root_config ' => $ config ]);
54+ static ::$ container ->get ('security.csrf.token_storage ' )->setToken ('foo ' , 'bar ' );
5155
5256 $ form = $ client ->request ('GET ' , '/login ' )->selectButton ('login ' )->form ();
5357 $ form ['user_login[_token] ' ] = '' ;
5458 $ client ->submit ($ form );
5559
60+ $ this ->assertTrue (static ::$ container ->get ('security.csrf.token_storage ' )->hasToken ('foo ' ));
61+
5662 $ this ->assertRedirect ($ client ->getResponse (), '/login ' );
5763
5864 $ text = $ client ->followRedirect ()->text (null , true );
0 commit comments