[英]How do i check if a function is working fine without running it in the browser In PHP(Laravel 5.6)
這是我嘗試運行的示例函數。
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();
}
您應該簽出PHPUnit並進行測試。 也許使用Mockery模擬對象。 默認情況下,它已包含在Laravel 5.6中。 一切都可以在文檔中找到: https : //laravel.com/docs/5.6/testing
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.