fix: keep lead invite command aliases (#406)

## Sentry issue
- https://whisper-money.sentry.io/issues/PHP-LARAVEL-1H

## Root cause
Production invoked old/typoed Artisan command names (`leads:send-invite`
/ `leads:send-invites`) after the command was named
`leads:send-invitations`, causing Symfony CommandNotFoundException
before command logic ran.

## Fix
- Add compatibility aliases for previous invite command names.
- Add regression coverage that both aliases execute successfully.

## Verification
- `vendor/bin/pint --dirty --format agent`
- `php artisan test --compact
tests/Feature/Commands/SendUserLeadInvitationsTest.php`
This commit is contained in:
Víctor Falcón 2026-05-20 11:26:21 +01:00 committed by GitHub
parent 66ff427481
commit 11f989d03a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 0 deletions

View File

@ -22,6 +22,11 @@ class SendUserLeadInvitations extends Command
protected $description = 'Send launch invitation emails to the next batch of waitlist leads';
protected $aliases = [
'leads:send-invite',
'leads:send-invites',
];
public function handle(LeadCohortResolver $resolver, LeadPromoCodeAllocator $allocator): int
{
$limit = (int) $this->option('limit');

View File

@ -22,6 +22,15 @@ beforeEach(function (): void {
});
});
it('keeps the previous invite command aliases available', function (string $command): void {
$this->artisan($command, ['--dry-run' => true])
->expectsOutput('No pending leads found.')
->assertSuccessful();
})->with([
'singular alias' => 'leads:send-invite',
'plural alias' => 'leads:send-invites',
]);
it('sends invitations to the next batch ordered by position', function (): void {
UserLead::factory()->count(15)->state(new Sequence(
...array_map(fn (int $i) => ['position' => $i, 'email_verified_at' => now()], range(1, 15)),