Assertions
hasEmailOutputOnFailure
Asserts that the command has the given email recipients configured to receive an email with output on failure.
$this->assertSchedule('command')
->hasEmailOutputOnFailure('email@gmail.com');
Multiple recipients can be checked by using an array:
$this->assertSchedule('command')
->hasEmailOutputOnFailure(['email@gmail.com', 'email@outlook.com']);
hasExpression
Asserts that the command has the given cron expression.
$this->assertSchedule('command')
->hasExpression('0 * * * *');
hasTimezone
Asserts that the command has the given timezone.
$this->assertSchedule('command')
->hasTimezone('Australia/Perth');
Or you can pass a DateTimeZone:
$this->assertSchedule('command')
->hasTimezone(new DateTimeZone('Australia/Perth'));
isScheduled
Asserts that the command has a defined schedule.
$this->assertSchedule('command')
->isScheduled();
An optional parameter can be provided to check that the command is scheduled to run at the given time.
$this->assertSchedule('command')
->isScheduled(now()->startOfDay());
isScheduledToRunAt
Asserts that the command is scheduled to run at the provided date.
$this->assertSchedule('command')
->isScheduledToRunAt(now()->startOfDay());
runsInEnvironment
Asserts that the command is scheduled to run in all provided environments.
$this->assertSchedule('command')
->runsInEnvironment('production');
Multiple environments can be checked by using an array:
$this->assertSchedule('command')
->runsInEnvironment(['production', 'staging']);
runsInMaintenanceMode
Asserts that the command is scheduled to run even while the application is in maintenance mode.
$this->assertSchedule('command')
->runsInMaintenanceMode();
canOverlap
Asserts that the scheduled task can overlap a previous instance of the task still running.
$this->assertSchedule('command')
->canOverlap();
cannotOverlap
Asserts that the scheduled task cannot overlap a previous instance of the task still running.
$this->assertSchedule('command')
->cannotOverlap();