Here is an example function that i'm trying to run.
protected function schedule(Schedule $schedule)
{
$schedule->call(function () {
$tickets = Ticketit::where('created_at', '<', Carbon::now()->subDays(1))->where('is_notified', false)->get();
foreach ($tickets as $ticket) {
//sending mail
$mail= $message->to('bonderi@strathmore.edu')->body('Your ticket is overdue');
}
})->hourly();
}
You should check out PHPUnit and testing. Maybe use Mockery for mocking objects. It is already included by default in Laravel 5.6. Everything can be found in the documentation: https://laravel.com/docs/5.6/testing
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.