Exemple #1
0
 protected function _setLogger(array $options)
 {
     if (!empty($this->_loggerFactory)) {
         self::$_logger = $this->_loggerFactory->create($options);
         $this->_encoder->setLogger(self::$_logger);
         $this->_decoder->setLogger(self::$_logger);
         $this->_driver->setLogger(self::$_logger);
         $this->_state->setLogger(self::$_logger);
     }
 }
Exemple #2
0
 public function testEncodingSimpleExceptions()
 {
     $this->markTestSkipped('Needs updated fixture.');
     $l = new Horde_Test_Log();
     $logger = $l->getLogger();
     //$logger = new Horde_Log_Logger(new Horde_Log_Handler_Stream(fopen('/tmp/test.log', 'a')));
     // Every other week recurrence, on thursday, no end.
     $r = new Horde_Date_Recurrence('2011-12-01T15:00:00');
     $r->setRecurType(Horde_Date_Recurrence::RECUR_WEEKLY);
     $r->setRecurInterval(2);
     $r->setRecurOnDay(Horde_Date::MASK_THURSDAY);
     $r->addException(2011, 12, 29);
     $e = new Horde_ActiveSync_Message_Exception();
     $d = new Horde_Date('2011-12-29T15:00:00');
     $e->setExceptionStartTime($d);
     $e->deleted = true;
     $appt = new Horde_ActiveSync_Message_Appointment(array('logger' => $logger));
     $appt->setSubject('Event Title');
     $appt->setBody('Event Description');
     $appt->setLocation('Philadelphia, PA');
     $start = new Horde_Date('2011-12-01T15:00:00');
     $appt->setDatetime(array('start' => $start, 'end' => new Horde_Date('2011-12-01T16:00:00'), 'allday' => false));
     $appt->setTimezone($start);
     $appt->setSensitivity(Horde_ActiveSync_Message_Appointment::SENSITIVITY_PERSONAL);
     $appt->setBusyStatus(Horde_ActiveSync_Message_Appointment::BUSYSTATUS_BUSY);
     $appt->setDTStamp($start->timestamp());
     $appt->setRecurrence($r);
     $appt->addException($e);
     $stream = fopen('php://memory', 'w+');
     $encoder = new Horde_ActiveSync_Wbxml_Encoder($stream);
     $encoder->setLogger($logger);
     $encoder->startTag(Horde_ActiveSync::SYNC_DATA);
     $appt->encodeStream($encoder);
     $encoder->endTag();
     $fixture = file_get_contents(__DIR__ . '/fixtures/simpleexception.wbxml');
     rewind($stream);
     $results = stream_get_contents($stream);
     fclose($stream);
     $this->assertEquals($fixture, $results);
 }