@@ -18,30 +18,30 @@ class AnonymousAuthenticationListenerTest extends \PHPUnit_Framework_TestCase
18
18
{
19
19
public function testHandleWithTokenStorageHavingAToken ()
20
20
{
21
- $ tokenStorage = $ this ->getMock ('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface ' );
21
+ $ tokenStorage = $ this ->getMockBuilder ('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface ' )-> getMock ( );
22
22
$ tokenStorage
23
23
->expects ($ this ->any ())
24
24
->method ('getToken ' )
25
- ->will ($ this ->returnValue ($ this ->getMock ('Symfony\Component\Security\Core\Authentication\Token\TokenInterface ' )))
25
+ ->will ($ this ->returnValue ($ this ->getMockBuilder ('Symfony\Component\Security\Core\Authentication\Token\TokenInterface ' )-> getMock ( )))
26
26
;
27
27
$ tokenStorage
28
28
->expects ($ this ->never ())
29
29
->method ('setToken ' )
30
30
;
31
31
32
- $ authenticationManager = $ this ->getMock ('Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface ' );
32
+ $ authenticationManager = $ this ->getMockBuilder ('Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface ' )-> getMock ( );
33
33
$ authenticationManager
34
34
->expects ($ this ->never ())
35
35
->method ('authenticate ' )
36
36
;
37
37
38
38
$ listener = new AnonymousAuthenticationListener ($ tokenStorage , 'TheSecret ' , null , $ authenticationManager );
39
- $ listener ->handle ($ this ->getMock ('Symfony\Component\HttpKernel\Event\GetResponseEvent ' , array (), array (), '' , false ));
39
+ $ listener ->handle ($ this ->getMockBuilder ('Symfony\Component\HttpKernel\Event\GetResponseEvent ' )-> disableOriginalConstructor ()-> getMock ( ));
40
40
}
41
41
42
42
public function testHandleWithTokenStorageHavingNoToken ()
43
43
{
44
- $ tokenStorage = $ this ->getMock ('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface ' );
44
+ $ tokenStorage = $ this ->getMockBuilder ('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface ' )-> getMock ( );
45
45
$ tokenStorage
46
46
->expects ($ this ->any ())
47
47
->method ('getToken ' )
@@ -50,7 +50,7 @@ public function testHandleWithTokenStorageHavingNoToken()
50
50
51
51
$ anonymousToken = new AnonymousToken ('TheSecret ' , 'anon. ' , array ());
52
52
53
- $ authenticationManager = $ this ->getMock ('Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface ' );
53
+ $ authenticationManager = $ this ->getMockBuilder ('Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface ' )-> getMock ( );
54
54
$ authenticationManager
55
55
->expects ($ this ->once ())
56
56
->method ('authenticate ' )
@@ -67,21 +67,21 @@ public function testHandleWithTokenStorageHavingNoToken()
67
67
;
68
68
69
69
$ listener = new AnonymousAuthenticationListener ($ tokenStorage , 'TheSecret ' , null , $ authenticationManager );
70
- $ listener ->handle ($ this ->getMock ('Symfony\Component\HttpKernel\Event\GetResponseEvent ' , array (), array (), '' , false ));
70
+ $ listener ->handle ($ this ->getMockBuilder ('Symfony\Component\HttpKernel\Event\GetResponseEvent ' )-> disableOriginalConstructor ()-> getMock ( ));
71
71
}
72
72
73
73
public function testHandledEventIsLogged ()
74
74
{
75
- $ tokenStorage = $ this ->getMock ('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface ' );
76
- $ logger = $ this ->getMock ('Psr\Log\LoggerInterface ' );
75
+ $ tokenStorage = $ this ->getMockBuilder ('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface ' )-> getMock ( );
76
+ $ logger = $ this ->getMockBuilder ('Psr\Log\LoggerInterface ' )-> getMock ( );
77
77
$ logger ->expects ($ this ->once ())
78
78
->method ('info ' )
79
79
->with ('Populated the TokenStorage with an anonymous Token. ' )
80
80
;
81
81
82
- $ authenticationManager = $ this ->getMock ('Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface ' );
82
+ $ authenticationManager = $ this ->getMockBuilder ('Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface ' )-> getMock ( );
83
83
84
84
$ listener = new AnonymousAuthenticationListener ($ tokenStorage , 'TheSecret ' , $ logger , $ authenticationManager );
85
- $ listener ->handle ($ this ->getMock ('Symfony\Component\HttpKernel\Event\GetResponseEvent ' , array (), array (), '' , false ));
85
+ $ listener ->handle ($ this ->getMockBuilder ('Symfony\Component\HttpKernel\Event\GetResponseEvent ' )-> disableOriginalConstructor ()-> getMock ( ));
86
86
}
87
87
}
0 commit comments