use Symfony\Component\Scheduler\Trigger\TriggerInterface;
class PeriodicalTriggerTest extends TestCase
{ /**
* @dataProvider provideForConstructor
*/
public function testConstructor(PeriodicalTrigger
$trigger, bool
$optimizable = true
) { $run =
new \
DateTimeImmutable('2922-02-22 12:34:00+00:00'
);
$this->
assertSame('2922-02-23 13:34:00+01:00',
$trigger->
getNextRunDate($run)->
format('Y-m-d H:i:sP'
));
if ($optimizable) { // test that we are using the fast algorithm for short period of time
$p =
new \
ReflectionProperty($trigger, 'intervalInSeconds'
);
$this->
assertNotSame(0,
$p->
getValue($trigger));
} } public static function provideForConstructor(): iterable
{ $from =
new \
DateTimeImmutable($now = '2022-02-22 13:34:00+01:00'
);