diff --git a/src/Commands/ClearExpiredImpersonationTokens.php b/src/Commands/PurgeImpersonationTokens.php similarity index 79% rename from src/Commands/ClearExpiredImpersonationTokens.php rename to src/Commands/PurgeImpersonationTokens.php index 1327cad6..b64b29f8 100644 --- a/src/Commands/ClearExpiredImpersonationTokens.php +++ b/src/Commands/PurgeImpersonationTokens.php @@ -10,13 +10,13 @@ use Stancl\Tenancy\Features\UserImpersonation; /** * Clears expired impersonation tokens. * - * Tokens older than UserImpersonation::$ttl (60 seconds by default) are considered expired. + * Tokens older than UserImpersonation::$ttl are considered expired. * * @see Stancl\Tenancy\Features\UserImpersonation */ -class ClearExpiredImpersonationTokens extends Command +class PurgeImpersonationTokens extends Command { - protected $signature = 'tenants:clear-expired-impersonation-tokens'; + protected $signature = 'tenants:purge-impersonation-tokens'; protected $description = 'Clear expired impersonation tokens.'; diff --git a/src/TenancyServiceProvider.php b/src/TenancyServiceProvider.php index 96523d23..9b32f088 100644 --- a/src/TenancyServiceProvider.php +++ b/src/TenancyServiceProvider.php @@ -119,8 +119,8 @@ class TenancyServiceProvider extends ServiceProvider Commands\MigrateFresh::class, Commands\ClearPendingTenants::class, Commands\CreatePendingTenants::class, + Commands\PurgeImpersonationTokens::class, Commands\CreateUserWithRLSPolicies::class, - Commands\ClearExpiredImpersonationTokens::class, ]); if (static::$migrateFreshOverride) { diff --git a/tests/TenantUserImpersonationTest.php b/tests/TenantUserImpersonationTest.php index a7db662b..ea679357 100644 --- a/tests/TenantUserImpersonationTest.php +++ b/tests/TenantUserImpersonationTest.php @@ -382,7 +382,7 @@ test('expired impersonation tokens can be cleaned up using a command', function expect(ImpersonationToken::find($oldToken->token))->not()->toBeNull(); expect(ImpersonationToken::find($anotherOldToken->token))->not()->toBeNull(); - pest()->artisan('tenants:clear-expired-impersonation-tokens') + pest()->artisan('tenants:purge-impersonation-tokens') ->assertExitCode(0) ->expectsOutputToContain('2 expired impersonation tokens deleted'); @@ -399,7 +399,7 @@ test('expired impersonation tokens can be cleaned up using a command', function // With ttl set to 80s, the active token should not be deleted (token is only considered expired if older than 80s) UserImpersonation::$ttl = 80; - pest()->artisan('tenants:clear-expired-impersonation-tokens') + pest()->artisan('tenants:purge-impersonation-tokens') ->assertExitCode(0) ->expectsOutputToContain('0 expired impersonation tokens deleted');