public function testProcessNotReturnsTrueTwiceWithinOneMinute()
 {
     $schedule = new Schedule();
     $schedule->setExpression('* * * * *');
     $schedule->setScheduledAt(new \DateTime('2010-01-01 00:00:00'));
     $this->factory->expects($this->any())->method('create')->with($schedule->getExpression())->will($this->returnValue($this->expression));
     $this->expression->expects($this->any())->method('isDue')->will($this->returnValue(true));
     $subject = new Processor(new ExpressionFactory());
     $this->assertFalse($subject->process($schedule, new \DateTime('2010-01-01 00:00:00')));
 }
 /**
  * {@inheritDoc}
  */
 public function process(ScheduleInterface $schedule, \DateTime $currentDateTime = null)
 {
     // ensure that a schedule is not executed twice within in a minute
     $now = $currentDateTime == null ? new \DateTime() : $currentDateTime;
     if ($schedule->getScheduledAt() != null && $schedule->getScheduledAt()->format('Y-m-d H:i') == $now->format('Y-m-d H:i')) {
         return false;
     }
     $cron = $this->expressionFactory->create($schedule->getExpression());
     return $cron->isDue($currentDateTime);
 }