@@ -96,7 +96,7 @@ public function test_database_sync_fails_without_object_guid()
96
96
$ this ->assertFalse (Auth::attempt (['mail ' => $ user ->mail [0 ], 'password ' => 'secret ' ]));
97
97
}
98
98
99
- public function test_database_authentication_falls_back_when_enabled ()
99
+ public function test_database_authentication_fallback_works_when_enabled_and_exception_is_thrown ()
100
100
{
101
101
$ this ->doesntExpectEvents ([
102
102
Authenticating::class,
@@ -131,6 +131,41 @@ public function test_database_authentication_falls_back_when_enabled()
131
131
$ this ->assertTrue ($ guard ->attempt (['email ' => $ user ->email , 'password ' => 'secret ' ]));
132
132
}
133
133
134
+ public function test_database_authentication_fallback_works_when_enabled_and_null_is_returned ()
135
+ {
136
+ $ this ->doesntExpectEvents ([
137
+ Authenticating::class,
138
+ Authenticated::class,
139
+ DiscoveredWithCredentials::class,
140
+ Importing::class,
141
+ Imported::class,
142
+ Synchronizing::class,
143
+ Synchronized::class,
144
+ ]);
145
+
146
+ DirectoryEmulator::setup ();
147
+
148
+ $ this ->setupDatabaseUserProvider ([
149
+ 'database ' => ['fallback ' => true ],
150
+ ]);
151
+
152
+ $ guard = Auth::guard ();
153
+
154
+ $ databaseUserProvider = $ guard ->getProvider ();
155
+
156
+ $ databaseUserProvider ->resolveUsersUsing (function () {
157
+ return ;
158
+ });
159
+
160
+ $ user = TestUserModelStub::create ([
161
+ 'name ' => 'John Doe ' ,
162
+
163
+ 'password ' => Hash::make ('secret ' ),
164
+ ]);
165
+
166
+ $ this ->assertTrue ($ guard ->attempt (['email ' => $ user ->email , 'password ' => 'secret ' ]));
167
+ }
168
+
134
169
public function test_plain_ldap_authentication_passes ()
135
170
{
136
171
$ this ->expectsEvents ([
0 commit comments