20
20
use Symfony \Component \Security \Core \Authentication \Token \Storage \TokenStorageInterface ;
21
21
use Symfony \Component \Security \Core \Authentication \Token \TokenInterface ;
22
22
use Symfony \Component \Security \Http \RememberMe \RememberMeHandlerInterface ;
23
- use Symfony \Component \Security \Http \RememberMe \RememberMeServicesInterface ;
24
23
use Symfony \Component \Security \Http \Session \SessionAuthenticationStrategyInterface ;
25
24
26
25
class LoginManagerTest extends TestCase
27
26
{
28
27
public function testLogInUserWithRequestStack ()
29
28
{
30
- $ loginManager = $ this ->createLoginManager (' main ' );
29
+ $ loginManager = $ this ->createLoginManager ();
31
30
$ loginManager ->logInUser ('main ' , $ this ->mockUser ());
32
31
}
33
32
34
33
public function testLogInUserWithRememberMeHandler ()
35
34
{
36
- if (!interface_exists (RememberMeHandlerInterface::class)) {
37
- $ this ->markTestSkipped ('This test requires Symfony 5.3+. ' );
38
- }
39
-
40
35
$ response = new Response ();
41
36
$ user = $ this ->mockUser ();
42
37
@@ -45,35 +40,11 @@ public function testLogInUserWithRememberMeHandler()
45
40
->method ('createRememberMeCookie ' )
46
41
->with ($ user );
47
42
48
- $ loginManager = $ this ->createLoginManager (' main ' , $ rememberMeHandler );
43
+ $ loginManager = $ this ->createLoginManager ($ rememberMeHandler );
49
44
$ loginManager ->logInUser ('main ' , $ user , $ response );
50
45
}
51
46
52
- /**
53
- * @group legacy
54
- */
55
- public function testLogInUserWithRememberMeService ()
56
- {
57
- if (!interface_exists (RememberMeServicesInterface::class)) {
58
- $ this ->markTestSkipped ('This test does not support Symfony 6+. ' );
59
- }
60
-
61
- $ response = new Response ();
62
-
63
- $ rememberMeService = $ this ->createMock (RememberMeServicesInterface::class);
64
- $ rememberMeService
65
- ->expects ($ this ->once ())
66
- ->method ('loginSuccess ' )
67
- ->with ($ this ->isInstanceOf (Request::class), $ response , $ this ->isInstanceOf (TokenInterface::class));
68
-
69
- $ loginManager = $ this ->createLoginManager ('main ' , $ rememberMeService );
70
- $ loginManager ->logInUser ('main ' , $ this ->mockUser (), $ response );
71
- }
72
-
73
- /**
74
- * @param RememberMeHandlerInterface|RememberMeServicesInterface|null $rememberMeHandler
75
- */
76
- private function createLoginManager (string $ firewallName , $ rememberMeHandler = null ): LoginManager
47
+ private function createLoginManager (?RememberMeHandlerInterface $ rememberMeHandler = null ): LoginManager
77
48
{
78
49
$ tokenStorage = $ this ->getMockBuilder (TokenStorageInterface::class)->getMock ();
79
50
$ tokenStorage
0 commit comments