8000 [Security] fix merge of 2.7 into 2.8 + add test case · symfony/symfony@0c47785 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0c47785

Browse files
committed
[Security] fix merge of 2.7 into 2.8 + add test case
1 parent c337bf6 commit 0c47785

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/Symfony/Component/Security/Http/Tests/Firewall/UsernamePasswordFormAuthenticationListenerTest.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,11 @@ public function testHandleWhenUsernameLength($username, $ok)
7777
}
7878

7979
/**
80+
* @dataProvider postOnlyDataProvider
8081
* @expectedException \Symfony\Component\HttpKernel\Exception\BadRequestHttpException
8182
* @expectedExceptionMessage The key "_username" must be a string, "array" given.
8283
*/
83-
public function testHandleNonStringUsername()
84+
public function testHandleNonStringUsername($postOnly)
8485
{
8586
$request = Request::create('/login_check', 'POST', array('_username' => array()));
8687
$request->setSession($this->getMockBuilder('Symfony\Component\HttpFoundation\Session\SessionInterface')->getMock());
@@ -93,14 +94,22 @@ public function testHandleNonStringUsername()
9394
'foo',
9495
new DefaultAuthenticationSuccessHandler($httpUtils),
9596
new DefaultAuthenticationFailureHandler($this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(), $httpUtils),
96-
array('require_previous_session' => false)
97+
array('require_previous_session' => false, 'post_only' => $postOnly)
9798
);
9899

99100
$event = new GetResponseEvent($this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(), $request, HttpKernelInterface::MASTER_REQUEST);
100101

101102
$listener->handle($event);
102103
}
103104

105+
public function postOnlyDataProvider()
106+
{
107+
return array(
108+
array(true),
109+
array(false),
110+
);
111+
}
112+
104113
public function getUsernameForLength()
105114
{
106115
return array(

0 commit comments

Comments
 (0)
0