Skip to content

Commit eaca085

Browse files
[SecurityBundle] fix failing test
1 parent 83a1061 commit eaca085

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Symfony/Bundle/SecurityBundle/Tests/Functional/SwitchUserTest.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ public function testSwitchUser($originalUser, $targetUser, $expectedUser, $expec
2525

2626
$client->request('GET', '/profile?_switch_user='.$targetUser);
2727

28+
if ('user_does_not_exist' === $targetUser && 403 === $expectedStatus && 500 === $client->getResponse()->getStatusCode()) {
29+
$expectedStatus = 500; // 403 is generated by Symfony >= 4.3.8
30+
}
31+
2832
$this->assertEquals($expectedStatus, $client->getResponse()->getStatusCode());
2933
$this->assertEquals($expectedUser, $client->getProfile()->getCollector('security')->getUser());
3034
}
@@ -68,7 +72,7 @@ public function getTestParameters()
6872
return [
6973
'unauthorized_user_cannot_switch' => ['user_cannot_switch_1', 'user_cannot_switch_1', 'user_cannot_switch_1', 403],
7074
'authorized_user_can_switch' => ['user_can_switch', 'user_cannot_switch_1', 'user_cannot_switch_1', 200],
71-
'authorized_user_cannot_switch_to_non_existent' => ['user_can_switch', 'user_does_not_exist', 'user_can_switch', 500],
75+
'authorized_user_cannot_switch_to_non_existent' => ['user_can_switch', 'user_does_not_exist', 'user_can_switch', 403],
7276
'authorized_user_can_switch_to_himself' => ['user_can_switch', 'user_can_switch', 'user_can_switch', 200],
7377
];
7478
}

0 commit comments

Comments
 (0)