10000 Merge branch '5.3' into 5.4 · symfony/symfony@c5b5115 · GitHub
[go: up one dir, main page]

Skip to content

Commit c5b5115

Browse files
Merge branch '5.3' into 5.4
* 5.3: [Security][SecurityBundle] Fix deprecations triggered in tests
2 parents 0aedd99 + 2f7dbed commit c5b5115

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

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

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,33 @@ public function testAliasedEvents()
3131
$dispatcher = $container->get('event_dispatcher');
3232

3333
$dispatcher->dispatch(new AuthenticationSuccessEvent($this->createMock(TokenInterface::class)), AuthenticationEvents::AUTHENTICATION_SUCCESS);
34-
$dispatcher->dispatch(new AuthenticationFailureEvent($this->createMock(TokenInterface::class), new AuthenticationException()), AuthenticationEvents::AUTHENTICATION_FAILURE);
3534
$dispatcher->dispatch(new InteractiveLoginEvent($this->createMock(Request::class), $this->createMock(TokenInterface::class)), SecurityEvents::INTERACTIVE_LOGIN);
3635
$dispatcher->dispatch(new SwitchUserEvent($this->createMock(Request::class), $this->createMock(UserInterface::class), $this->createMock(TokenInterface::class)), SecurityEvents::SWITCH_USER);
3736

3837
$this->assertEquals(
3938
[
4039
'onAuthenticationSuccess' => 1,
41-
'onAuthenticationFailure' => 1,
4240
'onInteractiveLogin' => 1,
4341
'onSwitchUser' => 1,
4442
],
4543
$container->get('test_subscriber')->calledMethods
4644
);
4745
}
46+
47+
/**
48+
* @group legacy
49+
*/
50+
public function testAliasedLegacyEvent()
51+
{
52+
$client = $this->createClient(['test_case' => 'AliasedEvents', 'root_config' => 'config.yml']);
53+
$container = $client->getContainer();
54+
$dispatcher = $container->get('event_dispatcher');
55+
56+
$dispatcher->dispatch(new AuthenticationFailureEvent($this->createMock(TokenInterface::class), new AuthenticationException()), AuthenticationEvents::AUTHENTICATION_FAILURE);
57+
58+
$this->assertEquals(
59+
['onAuthenticationFailure' => 1],
60+
$container->get('test_subscriber')->calledMethods
61+
);
62+
}
4863
}

src/Symfony/Component/Security/Core/Tests/Authentication/Provider/DaoAuthenticationProviderTest.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@
2929
use Symfony\Component\Security\Core\User\UserInterface;
3030
use Symfony\Component\Security\Core\User\UserProviderInterface;
3131

32+
/**
33+
* @group legacy
34+
*/
3235
class DaoAuthenticationProviderTest extends TestCase
3336
{
3437
use ExpectDeprecationTrait;
3538

36-
/**
37-
* @group legacy
38-
*/
3939
public function testRetrieveUserWhenProviderDoesNotReturnAnUserInterface()
4040
{
4141
$this->expectException(AuthenticationServiceException::class);
@@ -53,9 +53,6 @@ public function testRetrieveUserWhenProviderDoesNotReturnAnUserInterface()
5353
$method->invoke($provider, 'fabien', $this->getSupportedToken());
5454
}
5555

56-
/**
57-
* @group legacy
5129 58-
*/
5956
public function testRetrieveUserWhenUsernameIsNotFoundWithLegacyEncoderFactory()
6057
{
6158
$this->expectException(UserNotFoundException::class);

0 commit comments

Comments
 (0)
0