prophesize(UserGroupRelatedToUserJobSyncInterface::class); $cronJob = new UserGroupRelatedToUserJobSyncCronJob($clock, $job->reveal()); if (null !== $lastStartExecution) { $lastExecution = new CronJobExecution('user-group-related-to-user-job-sync'); $lastExecution->setLastStart($lastStartExecution); } $actual = $cronJob->canRun($lastExecution ?? null); self::assertEquals($exected, $actual); } public static function canRunDataProvider(): iterable { $now = new \DateTimeImmutable('2025-04-27T00:00:00Z'); yield 'never executed' => [$now, null, true]; yield 'executed 12 hours ago' => [$now, new \DateTimeImmutable('2025-04-26T12:00:00Z'), false]; yield 'executed more than 12 hours ago' => [$now, new \DateTimeImmutable('2025-04-25T12:00:00Z'), true]; } }