77use Doctrine \ORM \EntityManagerInterface ;
88use Hslavich \OneloginSamlBundle \Security \Http \Authenticator \SamlAuthenticator ;
99use Hslavich \OneloginSamlBundle \Security \User \SamlUserFactoryInterface ;
10+ use Hslavich \OneloginSamlBundle \Security \User \SamlUserProvider ;
1011use Hslavich \OneloginSamlBundle \Tests \TestUser ;
1112use PHPUnit \Framework \MockObject \MockObject ;
1213use PHPUnit \Framework \MockObject \Rule \InvokedCount ;
1617use Symfony \Component \Security \Core \Exception \AuthenticationException ;
1718use Symfony \Component \Security \Core \Exception \SessionUnavailableException ;
1819use Symfony \Component \Security \Core \Exception \UsernameNotFoundException ;
19- use Symfony \Component \Security \Core \User \UserProviderInterface ;
2020use Symfony \Component \Security \Http \Authentication \AuthenticationFailureHandlerInterface ;
2121use Symfony \Component \Security \Http \Authentication \AuthenticationSuccessHandlerInterface ;
2222use Symfony \Component \Security \Http \Authenticator \Passport \UserPassportInterface ;
2323use Symfony \Component \Security \Http \HttpUtils ;
24- use const false ;
2524
2625class SamlAuthenticatorTest extends TestCase
2726{
@@ -40,7 +39,7 @@ public function testNoSessionException(Request $request, string $message): void
4039 {
4140 $ authenticator = new SamlAuthenticator (
4241 $ httpUtils = $ this ->createMock (HttpUtils::class),
43- $ this ->createMock (UserProviderInterface ::class),
42+ $ this ->createMock (SamlUserProvider ::class),
4443 $ this ->createMock (\OneLogin \Saml2 \Auth::class),
4544 $ this ->createMock (AuthenticationSuccessHandlerInterface::class),
4645 $ this ->createMock (AuthenticationFailureHandlerInterface::class),
@@ -73,7 +72,7 @@ public function testAuthenticationException(): void
7372
7473 $ authenticator = new SamlAuthenticator (
7574 $ httpUtils = $ this ->createMock (HttpUtils::class),
76- $ this ->createMock (UserProviderInterface ::class),
75+ $ this ->createMock (SamlUserProvider ::class),
7776 $ auth ,
7877 $ this ->createMock (AuthenticationSuccessHandlerInterface::class),
7978 $ this ->createMock (AuthenticationFailureHandlerInterface::class),
@@ -88,7 +87,7 @@ public function testAuthenticationException(): void
8887
8988 public function testUsernameNotFound (): void
9089 {
91- $ userProvider = $ this ->createMock (UserProviderInterface ::class);
90+ $ userProvider = $ this ->createMock (SamlUserProvider ::class);
9291 $ userProvider
9392 ->expects (self ::once ())
9493 ->method ('loadUserByUsername ' )
@@ -111,7 +110,7 @@ public function testUsernameNotFound(): void
111110
112111 public function testUserFactoryException (): void
113112 {
114- $ userProvider = $ this ->createMock (UserProviderInterface ::class);
113+ $ userProvider = $ this ->createMock (SamlUserProvider ::class);
115114 $ userProvider
116115 ->expects (self ::once ())
117116 ->method ('loadUserByUsername ' )
@@ -137,7 +136,7 @@ public function testAuthenticationWithLoad(): void
137136 {
138137 $ user = new TestUser ('test ' , ['ROLE_USER ' ]);
139138
140- $ userProvider = $ this ->createMock (UserProviderInterface ::class);
139+ $ userProvider = $ this ->createMock (SamlUserProvider ::class);
141140 $ userProvider
142141 ->expects (self ::once ())
143142 ->method ('loadUserByUsername ' )
@@ -163,7 +162,7 @@ public function testAuthenticationWithGenerate(): void
163162 {
164163 $ user = new TestUser ('test ' , ['ROLE_USER ' ]);
165164
166- $ userProvider = $ this ->createMock (UserProviderInterface ::class);
165+ $ userProvider = $ this ->createMock (SamlUserProvider ::class);
167166 $ userProvider
168167 ->expects (self ::once ())
169168 ->method ('loadUserByUsername ' )
@@ -223,7 +222,7 @@ private function createSamlAuthenticatorForSupports(InvokedCount $checkRequestEx
223222
224223 return new SamlAuthenticator (
225224 $ httpUtils ,
226- $ this ->createMock (UserProviderInterface ::class),
225+ $ this ->createMock (SamlUserProvider ::class),
227226 $ this ->createMock (\OneLogin \Saml2 \Auth::class),
228227 $ this ->createMock (AuthenticationSuccessHandlerInterface::class),
229228 $ this ->createMock (AuthenticationFailureHandlerInterface::class),
0 commit comments