예제 #1
0
 /**
  * @param string $name
  * @param string $event
  * @param string $seconds
  * @param array  $parameters
  * @param bool   $enabled
  *
  * @return Schedule
  */
 public function setTimer($name, $event, $seconds, $parameters = array(), $enabled = true)
 {
     $date = new \DateTime();
     $date->modify('+' . $seconds . ' seconds');
     $endTime = $date->format('Y-m-d H:i:s');
     return $this->model->createScheduleTimer($name, $event, $parameters, $endTime, $enabled);
 }
예제 #2
0
 /**
  * Test create schedule timer
  */
 public function testCreateScheduleTimer()
 {
     $scheduleDocument = $this->getMockObject('Litvinab\\Bundle\\CronEventBundle\\Document\\Schedule');
     $repository = $this->getMockObject('Litvinab\\Bundle\\CronEventBundle\\Repository\\ScheduleRepository', ['save']);
     $this->setMockMethodsReturnValue($repository, ['save'], $scheduleDocument);
     $model = new ScheduleModel($repository);
     $result = $model->createScheduleTimer('test', 'test', [], '20-05-2015');
     $this->assertEquals($scheduleDocument, $result);
 }