use Symfony\Component\Scheduler\RecurringMessage;
use Symfony\Component\Scheduler\Schedule;
use Symfony\Component\Scheduler\Scheduler;
class SchedulerTest extends TestCase
{ public function testCanRunAndStop() { $handler =
new Handler();
$handler->clock =
$clock =
new MockClock();
$schedule =
(new Schedule())->
add(RecurringMessage::
every('1 second',
new Message()));
$scheduler =
new Scheduler([Message::
class => $handler],
[$schedule],
$clock);
$handler->scheduler =
$scheduler;
$scheduler->
run(['sleep' => 100
]);
$this->
assertSame(3,
$handler->count
);
}}class Message{}