use Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Messenger\FooMessage;
use Symfony\Component\Clock\MockClock;
use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Scheduler\Messenger\SchedulerTransport;
use Symfony\Component\Scheduler\RecurringMessage;
class SchedulerTest extends AbstractWebTestCase
{ public function testScheduler() { $scheduledMessages =
[ RecurringMessage::
every('5 minutes',
$foo =
new FooMessage(),
new \
DateTimeImmutable('2020-01-01T00:00:00Z'
)),
RecurringMessage::
every('5 minutes',
$bar =
new BarMessage(),
new \
DateTimeImmutable('2020-01-01T00:01:00Z'
)),
];
DummySchedule::
$recurringMessages =
$scheduledMessages;
$container = self::
getContainer();
$container->
set('clock',
$clock =
new MockClock('2020-01-01T00:09:59Z'
));
$this->
assertTrue($container->
get('receivers'
)->
has('scheduler_dummy'
));
$this->
assertInstanceOf(SchedulerTransport::
class,
$cron =
$container->
get('receivers'
)->
get('scheduler_dummy'
));
$fetchMessages =
static function Dfloat
$sleep) use ($clock,
$cron) {