changes output to a table

This commit is contained in:
Godfrey M 2025-02-26 12:30:19 -08:00
parent 8352e81228
commit 899119ae2d
2 changed files with 12 additions and 5 deletions

View file

@ -90,11 +90,14 @@ class SendAcceptanceReminder extends Command
} }
$this->info($count.' users notified.'); $this->info($count.' users notified.');
$output = "The following users do not have an email address:\n"; $headers = ['ID', 'Name'];
$rows = [];
foreach ($no_email_list as $user) { foreach ($no_email_list as $user) {
$output .= "ID: {$user['id']}, Name: {$user['name']}\n"; $rows[] = [$user['id'], $user['name']];
} }
$this->info($output); $this->info("The following users do not have an email address:");
$this->table($headers, $rows);
return 0; return 0;
} }

View file

@ -43,9 +43,13 @@ class SendAcceptanceReminderTest extends TestCase
CheckoutAcceptance::factory()->pending()->create([ CheckoutAcceptance::factory()->pending()->create([
'assigned_to_id' => $userA->id, 'assigned_to_id' => $userA->id,
]); ]);
$headers = ['ID', 'Name'];
$rows = [
[$userA->id, $userA->present()->fullName()],
];
$this->artisan('snipeit:acceptance-reminder') $this->artisan('snipeit:acceptance-reminder')
->expectsOutput("The following users do not have an email address:\nID: {$userA->id}, Name: {$userA->present()->fullName()}\n") ->expectsOutput("The following users do not have an email address:")
->expectsTable($headers, $rows)
->assertExitCode(0); ->assertExitCode(0);
Mail::assertNotSent(UnacceptedAssetReminderMail::class); Mail::assertNotSent(UnacceptedAssetReminderMail::class);