Exemplo n.º 1
0
 /**
  * FreeBusyCriteria constructor.
  *
  * @param array $params
  */
 public function __construct(array $params)
 {
     parent::__construct($params);
     if (isset($params['status'])) {
         if (FreeBusy::isValidStatus($params['status'])) {
             $this->status = $params['status'];
         } else {
             throw new InvalidArgumentException(sprintf('Invalid status "%s"', $params['status']));
         }
         throw new \RuntimeException('Status filter is not currently supported');
     }
 }
Exemplo n.º 2
0
 /**
  * Test getting criteria raw data
  */
 public function testToRaw()
 {
     $timezone = new DateTimeZone('Europe/Minsk');
     $fromDate = new DateTime('2016-05-06T10:20:00');
     $toDate = new DateTime('2016-11-12T10:20:00');
     $calendars = ['cal_one', 'cal_two', 'cal_three'];
     $criteria = new EventCriteria();
     $criteria->setTimezone($timezone);
     $criteria->setFromDate($fromDate);
     $criteria->setToDate($toDate);
     $criteria->setCalendars($calendars);
     $this->assertSame(['tzid' => 'Europe/Minsk', 'from' => '2016-05-06', 'to' => '2016-11-12', 'calendar_ids' => ['cal_one', 'cal_two', 'cal_three']], $criteria->toRaw());
 }