This repository was archived by the owner on Jul 24, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -29,18 +29,16 @@ class UserResolver implements ResolverInterface
2929 /**
3030 * The name of the LDAP connection to utilize.
3131 *
32- * @var string
32+ * @var string|null
3333 */
34- protected $ connection = ' default ' ;
34+ protected $ connection ;
3535
3636 /**
3737 * {@inheritdoc}
3838 */
3939 public function __construct (AdldapInterface $ ldap )
4040 {
4141 $ this ->ldap = $ ldap ;
42-
43- $ this ->setConnection ($ this ->getLdapAuthConnectionName ());
4442 }
4543
4644 /**
@@ -207,7 +205,7 @@ protected function getPasswordFromCredentials($credentials)
207205 */
208206 protected function getLdapAuthProvider () : ProviderInterface
209207 {
210- return $ this ->ldap ->getProvider ($ this ->connection );
208+ return $ this ->ldap ->getProvider ($ this ->connection ?? $ this -> getLdapAuthConnectionName () );
211209 }
212210
213211 /**
Original file line number Diff line number Diff line change @@ -88,13 +88,17 @@ public function scopes_are_applied_when_query_is_called()
8888 }
8989
9090 /** @test */
91- public function connection_is_set_upon_creation ()
91+ public function connection_is_set_when_retrieving_provider ()
9292 {
9393 Config::shouldReceive ('get ' )->once ()->with ('ldap_auth.connection ' , 'default ' )->andReturn ('other-test ' );
9494
9595 $ ad = m::mock (AdldapInterface::class);
9696
97- new UserResolver ($ ad );
97+ $ ad ->shouldReceive ('getProvider ' )->andReturn (m::mock (ProviderInterface::class));
98+
99+ $ r = m::mock (UserResolver::class, [$ ad ])->makePartial ();
100+
101+ $ r ->getLdapAuthProvider ();
98102 }
99103
100104 /** @test */
You can’t perform that action at this time.
0 commit comments