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
29
29
/**
30
30
* The name of the LDAP connection to utilize.
31
31
*
32
- * @var string
32
+ * @var string|null
33
33
*/
34
- protected $ connection = ' default ' ;
34
+ protected $ connection ;
35
35
36
36
/**
37
37
* {@inheritdoc}
38
38
*/
39
39
public function __construct (AdldapInterface $ ldap )
40
40
{
41
41
$ this ->ldap = $ ldap ;
42
-
43
- $ this ->setConnection ($ this ->getLdapAuthConnectionName ());
44
42
}
45
43
46
44
/**
@@ -207,7 +205,7 @@ protected function getPasswordFromCredentials($credentials)
207
205
*/
208
206
protected function getLdapAuthProvider () : ProviderInterface
209
207
{
210
- return $ this ->ldap ->getProvider ($ this ->connection );
208
+ return $ this ->ldap ->getProvider ($ this ->connection ?? $ this -> getLdapAuthConnectionName () );
211
209
}
212
210
213
211
/**
Original file line number Diff line number Diff line change @@ -88,13 +88,17 @@ public function scopes_are_applied_when_query_is_called()
88
88
}
89
89
90
90
/** @test */
91
- public function connection_is_set_upon_creation ()
91
+ public function connection_is_set_when_retrieving_provider ()
92
92
{
93
93
Config::shouldReceive ('get ' )->once ()->with ('ldap_auth.connection ' , 'default ' )->andReturn ('other-test ' );
94
94
95
95
$ ad = m::mock (AdldapInterface::class);
96
96
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 ();
98
102
}
99
103
100
104
/** @test */
You can’t perform that action at this time.
0 commit comments