@@ -77,14 +77,14 @@ public function testHandleWhenUsernameLength($username, $ok)
77
77
}
78
78
79
79
/**
80
+ * @dataProvider postOnlyDataProvider
80
81
* @expectedException \Symfony\Component\HttpKernel\Exception\BadRequestHttpException
81
82
* @expectedExceptionMessage The key "_username" must be a string, "array" given.
82
83
*/
83
- public function testHandleNonStringUsername ()
84
+ public function testHandleNonStringUsername ($ postOnly )
84
85
{
85
86
$ request = Request::create ('/login_check ' , 'POST ' , array ('_username ' => array ()));
86
87
$ request ->setSession ($ this ->getMockBuilder ('Symfony\Component\HttpFoundation\Session\SessionInterface ' )->getMock ());
87
-
88
88
$ listener = new UsernamePasswordFormAuthenticationListener (
89
89
new TokenStorage (),
90
90
$ this ->getMockBuilder ('Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface ' )->getMock (),
@@ -93,14 +93,20 @@ public function testHandleNonStringUsername()
93
93
'foo ' ,
94
94
new DefaultAuthenticationSuccessHandler ($ httpUtils ),
95
95
new DefaultAuthenticationFailureHandler ($ this ->getMockBuilder ('Symfony\Component\HttpKernel\HttpKernelInterface ' )->getMock (), $ httpUtils ),
96
- array ('require_previous_session ' => false )
96
+ array ('require_previous_session ' => false , ' post_only ' => $ postOnly )
97
97
);
98
-
99
98
$ event = new GetResponseEvent ($ this ->getMockBuilder ('Symfony\Component\HttpKernel\HttpKernelInterface ' )->getMock (), $ request , HttpKernelInterface::MASTER_REQUEST );
100
-
101
99
$ listener ->handle ($ event );
102
100
}
103
101
102
+ public function postOnlyDataProvider ()
103
+ {
104
+ return array (
105
+ array (true ),
106
+ array (false ),
107
+ );
108
+ }
109
+
104
110
public function getUsernameForLength ()
105
111
{
106
112
return array (
0 commit comments