|
150 | 150 | ->assertRedirect('/login'); |
151 | 151 | }); |
152 | 152 |
|
153 | | -test('stopImpersonating can keep the user authenticated', function() { |
| 153 | +test('stopImpersonating can keep the user authenticated', function () { |
154 | 154 | makeLoginRoute(); |
155 | 155 |
|
156 | 156 | Route::middleware(InitializeTenancyByPath::class)->prefix('/{tenant}')->group(getRoutes(false)); |
|
191 | 191 | ->assertSee('You are logged in as Joe'); |
192 | 192 | }); |
193 | 193 |
|
194 | | -test('stopImpersonating logs out the user from the impersonation guard stored in session', function() { |
| 194 | +test('stopImpersonating logs out the user from the impersonation guard stored in session', function () { |
195 | 195 | Route::middleware(InitializeTenancyByPath::class)->prefix('/{tenant}')->group(getRoutes(false)); |
196 | 196 |
|
197 | 197 | $tenant = Tenant::create([ |
|
225 | 225 | 'provider' => 'users', |
226 | 226 | ]]); |
227 | 227 |
|
228 | | - // Switch guard from 'web' to 'test' and manually log in the user through 'test' |
229 | | - auth()->shouldUse('test'); |
230 | | - auth()->loginUsingId($user->id); |
| 228 | + // Manually log the user in through the 'test' guard |
| 229 | + auth('test')->loginUsingId($user->id); |
231 | 230 |
|
232 | | - // Should log out the user from the guard used for impersonation ('web') |
| 231 | + // Should log the user out from the guard used for impersonation ('web') |
233 | 232 | UserImpersonation::stopImpersonating(); |
234 | 233 |
|
235 | 234 | expect(auth('web')->check())->toBeFalse(); |
|
241 | 240 | // stopImpersonating should throw an exception instead of logging out |
242 | 241 | expect(fn() => UserImpersonation::stopImpersonating())->toThrow(Exception::class); |
243 | 242 |
|
244 | | - expect(auth()->check())->toBeTrue(); |
| 243 | + expect(auth('test')->check())->toBeTrue(); |
245 | 244 | }); |
246 | 245 |
|
247 | 246 | test('tokens have a limited ttl', function () { |
|
0 commit comments