@@ -44,7 +44,7 @@ public function testAuthenticateWhenNoProviderSupportsToken()
44
44
));
45
45
46
46
try {
47
- $ manager ->authenticate ($ token = $ this ->getMock ('Symfony\Component\Security\Core\Authentication\Token\TokenInterface ' ));
47
+ $ manager ->authenticate ($ token = $ this ->getMockBuilder ('Symfony\Component\Security\Core\Authentication\Token\TokenInterface ' )-> getMock ( ));
48
48
$ this ->fail ();
49
49
} catch (ProviderNotFoundException $ e ) {
50
50
$ this ->assertSame ($ token , $ e ->getToken ());
@@ -58,7 +58,7 @@ public function testAuthenticateWhenProviderReturnsAccountStatusException()
58
58
));
59
59
60
60
try {
61
- $ manager ->authenticate ($ token = $ this ->getMock ('Symfony\Component\Security\Core\Authentication\Token\TokenInterface ' ));
61
+ $ manager ->authenticate ($ token = $ this ->getMockBuilder ('Symfony\Component\Security\Core\Authentication\Token\TokenInterface ' )-> getMock ( ));
62
62
$ this ->fail ();
63
63
} catch (AccountStatusException $ e ) {
64
64
$ this ->assertSame ($ token , $ e ->getToken ());
@@ -72,7 +72,7 @@ public function testAuthenticateWhenProviderReturnsAuthenticationException()
72
72
));
73
73
74
74
try {
75
- $ manager ->authenticate ($ token = $ this ->getMock ('Symfony\Component\Security\Core\Authentication\Token\TokenInterface ' ));
75
+ $ manager ->authenticate ($ token = $ this ->getMockBuilder ('Symfony\Component\Security\Core\Authentication\Token\TokenInterface ' )-> getMock ( ));
76
76
$ this ->fail ();
77
77
} catch (AuthenticationException $ e ) {
78
78
$ this ->assertSame ($ token , $ e ->getToken ());
@@ -83,26 +83,26 @@ public function testAuthenticateWhenOneReturnsAuthenticationExceptionButNotAll()
83
83
{
84
84
$ manager = new AuthenticationProviderManager (array (
85
85
$ this ->getAuthenticationProvider (true , null , 'Symfony\Component\Security\Core\Exception\AuthenticationException ' ),
86
- $ this ->getAuthenticationProvider (true , $ expected = $ this ->getMock ('Symfony\Component\Security\Core\Authentication\Token\TokenInterface ' )),
86
+ $ this ->getAuthenticationProvider (true , $ expected = $ this ->getMockBuilder ('Symfony\Component\Security\Core\Authentication\Token\TokenInterface ' )-> getMock ( )),
87
87
));
88
88
89
- $ token = $ manager ->authenticate ($ this ->getMock ('Symfony\Component\Security\Core\Authentication\Token\TokenInterface ' ));
89
+ $ token = $ manager ->authenticate ($ this ->getMockBuilder ('Symfony\Component\Security\Core\Authentication\Token\TokenInterface ' )-> getMock ( ));
90
90
$ this ->assertSame ($ expected , $ token );
91
91
}
92
92
93
93
public function testAuthenticateReturnsTokenOfTheFirstMatchingProvider ()
94
94
{
95
- $ second = $ this ->getMock ('Symfony\Component\Security\Core\Authentication\Provider\AuthenticationProviderInterface ' );
95
+ $ second = $ this ->getMockBuilder ('Symfony\Component\Security\Core\Authentication\Provider\AuthenticationProviderInterface ' )-> getMock ( );
96
96
$ second
97
97
->expects ($ this ->never ())
98
98
->method ('supports ' )
99
99
;
100
100
$ manager = new AuthenticationProviderManager (array (
101
- $ this ->getAuthenticationProvider (true , $ expected = $ this ->getMock ('Symfony\Component\Security\Core\Authentication\Token\TokenInterface ' )),
101
+ $ this ->getAuthenticationProvider (true , $ expected = $ this ->getMockBuilder ('Symfony\Component\Security\Core\Authentication\Token\TokenInterface ' )-> getMock ( )),
102
102
$ second ,
103
103
));
104
104
105
- $ token = $ manager ->authenticate ($ this ->getMock ('Symfony\Component\Security\Core\Authentication\Token\TokenInterface ' ));
105
+ $ token = $ manager ->authenticate ($ this ->getMockBuilder ('Symfony\Component\Security\Core\Authentication\Token\TokenInterface ' )-> getMock ( ));
106
106
$ this ->assertSame ($ expected , $ token );
107
107
}
108
108
@@ -112,20 +112,20 @@ public function testEraseCredentialFlag()
112
112
$ this ->getAuthenticationProvider (true , $ token = new UsernamePasswordToken ('foo ' , 'bar ' , 'key ' )),
113
113
));
114
114
115
- $ token = $ manager ->authenticate ($ this ->getMock ('Symfony\Component\Security\Core\Authentication\Token\TokenInterface ' ));
115
+ $ token = $ manager ->authenticate ($ this ->getMockBuilder ('Symfony\Component\Security\Core\Authentication\Token\TokenInterface ' )-> getMock ( ));
116
116
$ this ->assertEquals ('' , $ token ->getCredentials ());
117
117
118
118
$ manager = new AuthenticationProviderManager (array (
119
119
$ this ->getAuthenticationProvider (true , $ token = new UsernamePasswordToken ('foo ' , 'bar ' , 'key ' )),
120
120
), false );
121
121
122
- $ token = $ manager ->authenticate ($ this ->getMock ('Symfony\Component\Security\Core\Authentication\Token\TokenInterface ' ));
122
+ $ token = $ manager ->authenticate ($ this ->getMockBuilder ('Symfony\Component\Security\Core\Authentication\Token\TokenInterface ' )-> getMock ( ));
123
123
$ this ->assertEquals ('bar ' , $ token ->getCredentials ());
124
124
}
125
125
126
126
protected function getAuthenticationProvider ($ supports , $ token = null , $ exception = null )
127
127
{
128
- $ provider = $ this ->getMock ('Symfony\Component\Security\Core\Authentication\Provider\AuthenticationProviderInterface ' );
128
+ $ provider = $ this ->getMockBuilder ('Symfony\Component\Security\Core\Authentication\Provider\AuthenticationProviderInterface ' )-> getMock ( );
129
129
$ provider ->expects ($ this ->once ())
130
130
->method ('supports ' )
131
131
->will ($ this ->returnValue ($ supports ))
@@ -139,7 +139,7 @@ protected function getAuthenticationProvider($supports, $token = null, $exceptio
139
139
} elseif (null !== $ exception ) {
140
140
$ provider ->expects ($ this ->once ())
141
141
F438
->method ('authenticate ' )
142
- ->will ($ this ->throwException ($ this ->getMock ($ exception, null , array (), '' )))
142
+ ->will ($ this ->throwException ($ this ->getMockBuilder ($ exception)-> setMethods ( null )-> getMock ( )))
143
143
;
144
144
}
145
145
0 commit comments