Add test on nextRunDate in KeyCheckWorker

[MAILPOET-3271]
This commit is contained in:
Jan Lysý
2021-01-14 16:59:43 +01:00
committed by Veljko V
parent 3a7beb6e3f
commit 84f2d5de0b
2 changed files with 30 additions and 3 deletions

View File

@@ -34,9 +34,11 @@ class SendingServiceKeyCheckTest extends \MailPoetTest {
}
public function testItRunsEveryHourWhenKeyPendingApproval() {
// normally next run is scheduled at a start of next day
expect($this->worker->getNextRunDate()->format('Y-m-d H:i:s'))
->equals(Carbon::now()->startOfDay()->addDay()->format('Y-m-d H:i:s'));
// normally next run is scheduled at the next day in first six hours
$nextRun = $this->worker->getNextRunDate();
$nextDay = Carbon::now()->startOfDay()->addDay()->addHours(6);
expect($nextRun->format('Y-m-d'))->equals($nextDay->format('Y-m-d'));
expect($nextRun)->lessThan($nextDay);
// when pending key approval, next run is scheduled in an hour
$settings = $this->diContainer->get(SettingsController::class);