From e3cc61347707670b89861a543e5d3a2522946b7e Mon Sep 17 00:00:00 2001 From: Constantin Graf Date: Fri, 12 Apr 2024 11:49:31 +0200 Subject: [PATCH] Added test commands --- .../Commands/Test/TestEmailCommand.php | 41 +++++++++++++++++ app/Console/Commands/Test/TestJobCommand.php | 37 ++++++++++++++++ .../Commands/Test/TestOutputCommand.php | 35 +++++++++++++++ app/Jobs/Test/TestJob.php | 44 +++++++++++++++++++ 4 files changed, 157 insertions(+) create mode 100644 app/Console/Commands/Test/TestEmailCommand.php create mode 100644 app/Console/Commands/Test/TestJobCommand.php create mode 100644 app/Console/Commands/Test/TestOutputCommand.php create mode 100644 app/Jobs/Test/TestJob.php diff --git a/app/Console/Commands/Test/TestEmailCommand.php b/app/Console/Commands/Test/TestEmailCommand.php new file mode 100644 index 00000000..00d0c056 --- /dev/null +++ b/app/Console/Commands/Test/TestEmailCommand.php @@ -0,0 +1,41 @@ +argument('email'); + Mail::raw('Hello World!', function (Message $message) use ($email): void { + $message->to($email) + ->subject('Test Email') + ->html('

Hello World!

'); + }); + + return self::SUCCESS; + } +} diff --git a/app/Console/Commands/Test/TestJobCommand.php b/app/Console/Commands/Test/TestJobCommand.php new file mode 100644 index 00000000..b836d6c6 --- /dev/null +++ b/app/Console/Commands/Test/TestJobCommand.php @@ -0,0 +1,37 @@ +info('Test command output'); + $this->error('Test command output error'); + + return self::SUCCESS; + } +} diff --git a/app/Jobs/Test/TestJob.php b/app/Jobs/Test/TestJob.php new file mode 100644 index 00000000..a0eb39a4 --- /dev/null +++ b/app/Jobs/Test/TestJob.php @@ -0,0 +1,44 @@ +user = $user; + $this->message = $message; + } + + /** + * Execute the job. + */ + public function handle(): void + { + Log::debug('TestJob: '.$this->message, [ + 'user' => $this->user->getKey(), + ]); + } +}