mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-06 02:04:04 +00:00
Make the exception only about requiring a stateful guard
This commit is contained in:
parent
7802c280ed
commit
f1e93a0ca0
4 changed files with 19 additions and 19 deletions
|
|
@ -24,7 +24,7 @@ use Stancl\Tenancy\Database\Models\ImpersonationToken;
|
|||
use Stancl\Tenancy\Middleware\InitializeTenancyByPath;
|
||||
use Stancl\Tenancy\Middleware\InitializeTenancyByDomain;
|
||||
use Stancl\Tenancy\Bootstrappers\DatabaseTenancyBootstrapper;
|
||||
use Stancl\Tenancy\Exceptions\ImpersonationTokenCouldNotBeCreatedWithNonStatefulGuard;
|
||||
use Stancl\Tenancy\Exceptions\StatefulGuardRequiredException;
|
||||
|
||||
beforeEach(function () {
|
||||
pest()->artisan('migrate', [
|
||||
|
|
@ -257,7 +257,7 @@ test('impersonation tokens can be created only with stateful guards', function (
|
|||
Auth::extend('nonstateful', fn($app, $name, array $config) => new TokenGuard(Auth::createUserProvider($config['provider']), request()));
|
||||
|
||||
expect(fn() => tenancy()->impersonate($tenant, $user->id, '/dashboard', 'nonstateful'))
|
||||
->toThrow(ImpersonationTokenCouldNotBeCreatedWithNonStatefulGuard::class);
|
||||
->toThrow(StatefulGuardRequiredException::class);
|
||||
|
||||
Auth::extend('stateful', fn ($app, $name, array $config) => new SessionGuard($name, Auth::createUserProvider($config['provider']), session()));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue