@@ -26,13 +26,13 @@ class AuthenticationProviderManagerTest extends TestCase
2626{
2727 public function testAuthenticateWithoutProviders ()
2828 {
29- $ this ->expectException (' InvalidArgumentException ' );
29+ $ this ->expectException (\ InvalidArgumentException::class );
3030 new AuthenticationProviderManager ([]);
3131 }
3232
3333 public function testAuthenticateWithProvidersWithIncorrectInterface ()
3434 {
35- $ this ->expectException (' InvalidArgumentException ' );
35+ $ this ->expectException (\ InvalidArgumentException::class );
3636 (new AuthenticationProviderManager ([
3737 new \stdClass (),
3838 ]))->authenticate ($ this ->getMockBuilder (TokenInterface::class)->getMock ());
@@ -45,7 +45,7 @@ public function testAuthenticateWhenNoProviderSupportsToken()
4545 ]);
4646
4747 try {
48- $ manager ->authenticate ($ token = $ this ->getMockBuilder (' Symfony\Component\Security\Core\Authentication\Token\ TokenInterface' )->getMock ());
48+ $ manager ->authenticate ($ token = $ this ->getMockBuilder (TokenInterface::class )->getMock ());
4949 $ this ->fail ();
5050 } catch (ProviderNotFoundException $ e ) {
5151 $ this ->assertSame ($ token , $ e ->getToken ());
@@ -54,7 +54,7 @@ public function testAuthenticateWhenNoProviderSupportsToken()
5454
5555 public function testAuthenticateWhenProviderReturnsAccountStatusException ()
5656 {
57- $ secondAuthenticationProvider = $ this ->getMockBuilder (' Symfony\Component\Security\Core\Authentication\Provider\AuthenticationProviderInterface ' )->getMock ();
57+ $ secondAuthenticationProvider = $ this ->getMockBuilder (\ Symfony \Component \Security \Core \Authentication \Provider \AuthenticationProviderInterface::class )->getMock ();
5858
5959 $ manager = new AuthenticationProviderManager ([
6060 $ this ->getAuthenticationProvider (true , null , 'Symfony\Component\Security\Core\Exception\AccountStatusException ' ),
@@ -65,7 +65,7 @@ public function testAuthenticateWhenProviderReturnsAccountStatusException()
6565 $ secondAuthenticationProvider ->expects ($ this ->never ())->method ('supports ' );
6666
6767 try {
68- $ manager ->authenticate ($ token = $ this ->getMockBuilder (' Symfony\Component\Security\Core\Authentication\Token\ TokenInterface' )->getMock ());
68+ $ manager ->authenticate ($ token = $ this ->getMockBuilder (TokenInterface::class )->getMock ());
6969 $ this ->fail ();
7070 } catch (AccountStatusException $ e ) {
7171 $ this ->assertSame ($ token , $ e ->getToken ());
@@ -79,7 +79,7 @@ public function testAuthenticateWhenProviderReturnsAuthenticationException()
7979 ]);
8080
8181 try {
82- $ manager ->authenticate ($ token = $ this ->getMockBuilder (' Symfony\Component\Security\Core\Authentication\Token\ TokenInterface' )->getMock ());
82+ $ manager ->authenticate ($ token = $ this ->getMockBuilder (TokenInterface::class )->getMock ());
8383 $ this ->fail ();
8484 } catch (AuthenticationException $ e ) {
8585 $ this ->assertSame ($ token , $ e ->getToken ());
@@ -90,26 +90,26 @@ public function testAuthenticateWhenOneReturnsAuthenticationExceptionButNotAll()
9090 {
9191 $ manager = new AuthenticationProviderManager ([
9292 $ this ->getAuthenticationProvider (true , null , 'Symfony\Component\Security\Core\Exception\AuthenticationException ' ),
93- $ this ->getAuthenticationProvider (true , $ expected = $ this ->getMockBuilder (' Symfony\Component\Security\Core\Authentication\Token\ TokenInterface' )->getMock ()),
93+ $ this ->getAuthenticationProvider (true , $ expected = $ this ->getMockBuilder (TokenInterface::class )->getMock ()),
9494 ]);
9595
96- $ token = $ manager ->authenticate ($ this ->getMockBuilder (' Symfony\Component\Security\Core\Authentication\Token\ TokenInterface' )->getMock ());
96+ $ token = $ manager ->authenticate ($ this ->getMockBuilder (TokenInterface::class )->getMock ());
9797 $ this ->assertSame ($ expected , $ token );
9898 }
9999
100100 public function testAuthenticateReturnsTokenOfTheFirstMatchingProvider ()
101101 {
102- $ second = $ this ->getMockBuilder (' Symfony\Component\Security\Core\Authentication\Provider\AuthenticationProviderInterface ' )->getMock ();
102+ $ second = $ this ->getMockBuilder (\ Symfony \Component \Security \Core \Authentication \Provider \AuthenticationProviderInterface::class )->getMock ();
103103 $ second
104104 ->expects ($ this ->never ())
105105 ->method ('supports ' )
106106 ;
107107 $ manager = new AuthenticationProviderManager ([
108- $ this ->getAuthenticationProvider (true , $ expected = $ this ->getMockBuilder (' Symfony\Component\Security\Core\Authentication\Token\ TokenInterface' )->getMock ()),
108+ $ this ->getAuthenticationProvider (true , $ expected = $ this ->getMockBuilder (TokenInterface::class )->getMock ()),
109109 $ second ,
110110 ]);
111111
112- $ token = $ manager ->authenticate ($ this ->getMockBuilder (' Symfony\Component\Security\Core\Authentication\Token\ TokenInterface' )->getMock ());
112+ $ token = $ manager ->authenticate ($ this ->getMockBuilder (TokenInterface::class )->getMock ());
113113 $ this ->assertSame ($ expected , $ token );
114114 }
115115
@@ -119,25 +119,25 @@ public function testEraseCredentialFlag()
119119 $ this ->getAuthenticationProvider (true , $ token = new UsernamePasswordToken ('foo ' , 'bar ' , 'key ' )),
120120 ]);
121121
122- $ token = $ manager ->authenticate ($ this ->getMockBuilder (' Symfony\Component\Security\Core\Authentication\Token\ TokenInterface' )->getMock ());
122+ $ token = $ manager ->authenticate ($ this ->getMockBuilder (TokenInterface::class )->getMock ());
123123 $ this ->assertEquals ('' , $ token ->getCredentials ());
124124
125125 $ manager = new AuthenticationProviderManager ([
126126 $ this ->getAuthenticationProvider (true , $ token = new UsernamePasswordToken ('foo ' , 'bar ' , 'key ' )),
127127 ], false );
128128
129- $ token = $ manager ->authenticate ($ this ->getMockBuilder (' Symfony\Component\Security\Core\Authentication\Token\ TokenInterface' )->getMock ());
129+ $ token = $ manager ->authenticate ($ this ->getMockBuilder (TokenInterface::class )->getMock ());
130130 $ this ->assertEquals ('bar ' , $ token ->getCredentials ());
131131 }
132132
133133 public function testAuthenticateDispatchesAuthenticationFailureEvent ()
134134 {
135135 $ token = new UsernamePasswordToken ('foo ' , 'bar ' , 'key ' );
136- $ provider = $ this ->getMockBuilder (' Symfony\Component\Security\Core\Authentication\Provider\AuthenticationProviderInterface ' )->getMock ();
136+ $ provider = $ this ->getMockBuilder (\ Symfony \Component \Security \Core \Authentication \Provider \AuthenticationProviderInterface::class )->getMock ();
137137 $ provider ->expects ($ this ->once ())->method ('supports ' )->willReturn (true );
138138 $ provider ->expects ($ this ->once ())->method ('authenticate ' )->willThrowException ($ exception = new AuthenticationException ());
139139
140- $ dispatcher = $ this ->getMockBuilder (' Symfony\Component\EventDispatcher\EventDispatcherInterface ' )->getMock ();
140+ $ dispatcher = $ this ->getMockBuilder (\ Symfony \Component \EventDispatcher \EventDispatcherInterface::class )->getMock ();
141141 $ dispatcher
142142 ->expects ($ this ->once ())
143143 ->method ('dispatch ' )
@@ -158,11 +158,11 @@ public function testAuthenticateDispatchesAuthenticationSuccessEvent()
158158 {
159159 $ token = new UsernamePasswordToken ('foo ' , 'bar ' , 'key ' );
160160
161- $ provider = $ this ->getMockBuilder (' Symfony\Component\Security\Core\Authentication\Provider\AuthenticationProviderInterface ' )->getMock ();
161+ $ provider = $ this ->getMockBuilder (\ Symfony \Component \Security \Core \Authentication \Provider \AuthenticationProviderInterface::class )->getMock ();
162162 $ provider ->expects ($ this ->once ())->method ('supports ' )->willReturn (true );
163163 $ provider ->expects ($ this ->once ())->method ('authenticate ' )->willReturn ($ token );
164164
165- $ dispatcher = $ this ->getMockBuilder (' Symfony\Component\EventDispatcher\EventDispatcherInterface ' )->getMock ();
165+ $ dispatcher = $ this ->getMockBuilder (\ Symfony \Component \EventDispatcher \EventDispatcherInterface::class )->getMock ();
166166 $ dispatcher
167167 ->expects ($ this ->once ())
168168 ->method ('dispatch ' )
@@ -176,7 +176,7 @@ public function testAuthenticateDispatchesAuthenticationSuccessEvent()
176176
177177 protected function getAuthenticationProvider ($ supports , $ token = null , $ exception = null )
178178 {
179- $ provider = $ this ->getMockBuilder (' Symfony\Component\Security\Core\Authentication\Provider\AuthenticationProviderInterface ' )->getMock ();
179+ $ provider = $ this ->getMockBuilder (\ Symfony \Component \Security \Core \Authentication \Provider \AuthenticationProviderInterface::class )->getMock ();
180180 $ provider ->expects ($ this ->once ())
181181 ->method ('supports ' )
182182 ->willReturn ($ supports )
0 commit comments