From 899119ae2dcae3eb404a4af5627bafb8968830f7 Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Wed, 26 Feb 2025 12:30:19 -0800 Subject: [PATCH] changes output to a table --- app/Console/Commands/SendAcceptanceReminder.php | 9 ++++++--- tests/Feature/Console/SendAcceptanceReminderTest.php | 8 ++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/app/Console/Commands/SendAcceptanceReminder.php b/app/Console/Commands/SendAcceptanceReminder.php index 199bd07ed7..89a5b6167a 100644 --- a/app/Console/Commands/SendAcceptanceReminder.php +++ b/app/Console/Commands/SendAcceptanceReminder.php @@ -90,11 +90,14 @@ class SendAcceptanceReminder extends Command } $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) { - $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; } diff --git a/tests/Feature/Console/SendAcceptanceReminderTest.php b/tests/Feature/Console/SendAcceptanceReminderTest.php index 7c49f81cb4..ee28e09355 100644 --- a/tests/Feature/Console/SendAcceptanceReminderTest.php +++ b/tests/Feature/Console/SendAcceptanceReminderTest.php @@ -43,9 +43,13 @@ class SendAcceptanceReminderTest extends TestCase CheckoutAcceptance::factory()->pending()->create([ 'assigned_to_id' => $userA->id, ]); - + $headers = ['ID', 'Name']; + $rows = [ + [$userA->id, $userA->present()->fullName()], + ]; $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); Mail::assertNotSent(UnacceptedAssetReminderMail::class);