Closed
Description
Laravel Version
8.83
PHP Version
7.4
Database Driver & Version
N/A
Description
I was preparing some schedule tests for my Laravel package when I encountered the issue. I've noticed that neither ->isDue()
or ->nextRunDate()
takes ->between()
statements (which are essentially ->when()
) into account when determining schedules due time.
Steps To Reproduce
Following is the code snippet how I noticed the issue. I'm not sure if this is intended behavior or its missing something. Because for me, it doesn't make sense that ->isDue()
or ->nextRunDate()
doesn't take ->when()
or ->between()
statements into account. After all, you designate some time frame in the ->between()
.
$minTime='08:00';
$maxTime='18:00';
$mock=Carbon::createFromDate(2024,04,15)->setTime(04,15);
Carbon::setTestNow($mock);
$this->travelTo($mock);//redundant
$x=new Schedule();
$schedule=$x->command('test')->weekdays()->everyFiveMinutes()->between($minTime,$maxTime); //notice the ->between()
dump($schedule->nextRunDate($mock)->format('d-m-Y H:i')); //Outputs: "15-04-2024 04:20", expected: "15-04-2024 08:00"
dd($schedule->isDue(app())); //Outputs: true, expected: false
Metadata
Metadata
Assignees
Labels
No labels