Esempio n. 1
0
 /**
  * Test get event
  */
 public function testGetEvent()
 {
     $schedule = new Schedule();
     $schedule->setEvent('event');
     $this->assertEquals('event', $schedule->getEvent());
 }
 /**
  * Test find schedule by ad id event ad expired
  */
 public function testFindScheduleByAdIdEventAdExpired()
 {
     $schedule = new Schedule();
     $schedule->setName('testEvent');
     $schedule->setEnabled(true);
     $schedule->setStartTime(new \DateTime());
     $schedule->setStartTimeExpired(false);
     $schedule->setStatus('unexpired');
     $schedule->setType('event');
     $schedule->setEvent('ad.expired');
     $schedule->setParameters(['id' => 'test']);
     $this->dm->persist($schedule);
     $this->dm->flush();
     $result = $this->repository->getSchedulesByAdId('test')->getSingleResult();
     $this->assertCount(1, $result->getParameters());
     $this->assertContains('test', $result->getParameters());
 }
Esempio n. 3
0
 /**
  * @param string $name
  * @param string $event
  * @param array  $parameters
  * @param string $endTime
  * @param bool   $enabled
  *
  * @return Schedule
  */
 public function createScheduleTimer($name, $event, array $parameters, $endTime, $enabled = true)
 {
     $document = new Schedule();
     $document->setName($name);
     $document->setType('timer');
     $document->setEvent($event);
     $document->setParameters($parameters);
     $document->setEnabled($enabled);
     $document->setStatus('unexpired');
     $document->setStartTime(null);
     $document->setEndTime($endTime);
     $document->setStartTimeExpired(false);
     $document->setEndTimeExpired(false);
     return $this->save($document);
 }