File tree Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,7 @@ public function handle()
6464 ->groupBy (function ($ item ) {
6565 return $ item ['acceptance ' ]->assignedTo ? $ item ['acceptance ' ]->assignedTo ->id : '' ;
6666 });
67+ $ no_email_list = [];
6768
6869 foreach ($ unacceptedAssetGroups as $ unacceptedAssetGroup ) {
6970 // The [0] is weird, but it allows for the item_count to work and grabs the appropriate info for each user.
@@ -72,7 +73,10 @@ public function handle()
7273 $ locale = $ acceptance ->assignedTo ?->locale;
7374 $ email = $ acceptance ->assignedTo ?->email;
7475 if (!$ email ){
75- $ this ->info ($ acceptance ->assignedTo ?->present()->fullName ().' has no email address. ' );
76+ $ no_email_list [] = [
77+ 'id ' => $ acceptance ->assignedTo ->id ,
78+ 'name ' => $ acceptance ->assignedTo ->present ()->fullName (),
79+ ];
7680 }
7781 $ item_count = $ unacceptedAssetGroup ->count ();
7882
@@ -86,6 +90,14 @@ public function handle()
8690 }
8791
8892 $ this ->info ($ count .' users notified. ' );
93+ $ headers = ['ID ' , 'Name ' ];
94+ $ rows = [];
95+
96+ foreach ($ no_email_list as $ user ) {
97+ $ rows [] = [$ user ['id ' ], $ user ['name ' ]];
98+ }
99+ $ this ->info ("The following users do not have an email address: " );
100+ $ this ->table ($ headers , $ rows );
89101
90102 return 0 ;
91103 }
Original file line number Diff line number Diff line change @@ -43,9 +43,13 @@ public function testAcceptanceReminderCommandHandlesUserWithoutEmail()
4343 CheckoutAcceptance::factory ()->pending ()->create ([
4444 'assigned_to_id ' => $ userA ->id ,
4545 ]);
46-
46+ $ headers = ['ID ' , 'Name ' ];
47+ $ rows = [
48+ [$ userA ->id , $ userA ->present ()->fullName ()],
49+ ];
4750 $ this ->artisan ('snipeit:acceptance-reminder ' )
48- ->expectsOutput ($ userA ->present ()->fullName ().' has no email address. ' )
51+ ->expectsOutput ("The following users do not have an email address: " )
52+ ->expectsTable ($ headers , $ rows )
4953 ->assertExitCode (0 );
5054
5155 Mail::assertNotSent (UnacceptedAssetReminderMail::class);
You can’t perform that action at this time.
0 commit comments