Esempio n. 1
0
 /**
  *
  */
 protected function setUp()
 {
     $serviceManager = Bootstrap::getServiceManager();
     $this->config = $serviceManager->get('Config');
     $conn = $this->getConnection();
     $conn->getConnection()->query("set foreign_key_checks=0");
     parent::setUp();
     $conn->getConnection()->query("set foreign_key_checks=1");
     $service = new Event();
     $service->setDataSource(self::$pdo);
     $this->service = $service;
 }
Esempio n. 2
0
 public function testGet()
 {
     $service = new Event();
     $service->setDataSource(self::$pdo);
     $this->assertInstanceOf('stdClass', $service->get(1));
     $this->assertInstanceOf('stdClass', $service->get(2));
     $this->assertInstanceOf('stdClass', $service->get(1, 1));
     $this->assertFalse($service->get(1000));
 }
Esempio n. 3
0
 /**
  * @param DateTime $from
  * @param DateTime $to
  * @return array
  * @throws \Stjornvisi\Service\Exception
  */
 private function getEvents(DateTime $from, DateTime $to)
 {
     $eventService = new Event();
     $eventService->setDataSource($this->getDataSourceDriver())->setEventManager($this->getEventManager());
     return $eventService->getRange($from, $to);
 }
Esempio n. 4
0
 /**
  * @param $event_id
  * @return bool|\stdClass|Event
  * @throws NotifyException
  * @throws \Stjornvisi\Service\Exception
  */
 private function getEvent($event_id)
 {
     $event = new Event();
     $event->setDataSource($this->getDataSourceDriver())->setEventManager($this->getEventManager());
     if (($event = $event->get($event_id)) != false) {
         return $event;
     } else {
         throw new NotifyException("Event [{$event_id}] not found");
     }
 }