From 74c711d75cf30dba873c10eeba9aa5f508a69d5f Mon Sep 17 00:00:00 2001 From: philipp lang Date: Wed, 9 Nov 2022 01:33:31 +0100 Subject: [PATCH] Add LetterSendAction --- app/Console/Kernel.php | 2 ++ app/Letter/Actions/LetterSendAction.php | 4 +--- tests/Feature/Letter/LetterSendActionTest.php | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index c7dc3746..83ea3e63 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -2,6 +2,7 @@ namespace App\Console; +use App\Letter\Actions\LetterSendAction; use Illuminate\Console\Scheduling\Schedule; use Illuminate\Foundation\Console\Kernel as ConsoleKernel; @@ -13,6 +14,7 @@ class Kernel extends ConsoleKernel * @var array */ protected $commands = [ + LetterSendAction::class, ]; /** diff --git a/app/Letter/Actions/LetterSendAction.php b/app/Letter/Actions/LetterSendAction.php index 14cbd70c..d9a3ea59 100644 --- a/app/Letter/Actions/LetterSendAction.php +++ b/app/Letter/Actions/LetterSendAction.php @@ -16,10 +16,8 @@ class LetterSendAction /** * The name and signature of the console command. - * - * @var string */ - protected $signature = 'payment:send'; + public string $commandSignature = 'letter:send'; /** * The console command description. diff --git a/tests/Feature/Letter/LetterSendActionTest.php b/tests/Feature/Letter/LetterSendActionTest.php index c6f7c060..f110f822 100644 --- a/tests/Feature/Letter/LetterSendActionTest.php +++ b/tests/Feature/Letter/LetterSendActionTest.php @@ -8,6 +8,7 @@ use App\Member\Member; use App\Payment\Payment; use App\Payment\PaymentMail; use Illuminate\Foundation\Testing\DatabaseTransactions; +use Illuminate\Support\Facades\Artisan; use Illuminate\Support\Facades\Storage; use Mail; use Tests\TestCase; @@ -37,7 +38,7 @@ class LetterSendActionTest extends TestCase { Mail::fake(); - app(LetterSendAction::class)->handle(); + Artisan::call('letter:send'); Mail::assertSent(PaymentMail::class, fn ($mail) => Storage::path('rechnung-fur-mom.pdf') === $mail->filename); }