public static function run() { Log::info('Schedule run start.'); $client = new ActionCommandClient(); $result = $client->run(); Log::info('Schedule result.', $result); Log::info('Schedule run finish.'); return json_encode($result); }
public function test_invoke_command() { $company = factory(Company::class)->create(); $this->mockEmail(env('MAIL_FROM_ADDRESS'), env('MAIL_FROM_NAME'), $company, 'Licence Reminder', 'emails.company-reminder'); $schedule = factory(Schedule::class)->create(['run_at' => Carbon::now()->toDateString(), 'who_object' => Company::class, 'who_id' => $company->id, 'action' => ActionCommandSendReminderEmailCommand::class]); $client = new ActionCommandClient(); $resultsOfCommands = $client->run(); $expected = [['result' => 1, 'command' => ActionCommandSendReminderEmailCommand::class, 'success' => true, 'message' => '']]; $this->assertEquals($expected, $resultsOfCommands); }