/** * @requires extension bcmath */ public function testItipReply() { $log = new Horde_Test_Log(); $eml = file_get_contents(__DIR__ . '/fixtures/Itip_Reply.eml'); $mime = Horde_Mime_Part::parseMessage($eml); $winmail = $mime->getPart(2)->getContents(); $tnef = Horde_Compress::factory('Tnef', array('logger' => $log->getLogger())); $tnef_data = $tnef->decompress($winmail); // Test the generated iCalendar. $iCal = new Horde_Icalendar(); if (!$iCal->parsevCalendar($tnef_data[0]['stream'])) { throw new Horde_Compress_Exception(_("There was an error importing the iCalendar data.")); } $this->assertEquals($iCal->getAttribute('METHOD'), 'REPLY'); $components = $iCal->getComponents(); if (count($components) == 0) { throw new Horde_Compress_Exception(_("No iCalendar data was found.")); } $iTip = current($components); $this->assertEquals($iTip->getAttribute('SUMMARY'), 'Infoveranstaltung VDI/VDE Jena "Digitalisierung Medizintechnik"'); $this->assertEquals($iTip->getAttribute('UID'), 'D38D34D34D34F36D347B4D34EF87396F00000000367B4D3CD34D34D34D34D34D34D34D34D34D34D34D34D34D34D34D34D34D34D34D34E39D34D34D34EFAE37EB5E9CD9DE79EBDEB8D35D34D34D34DF6DF4DF5DF9DF4DF5DF5DF7DF5DF8DF7DF9DF5DFDD9EEF8EF6E74EBCE1FDFAE77EF6E36E35E3BE79E76E3DE37E3AEBCE76DF9E1EE1DEBBDF9E34EFBEFBEFBD9EE9EEB5EB7EBCEF8EBCEB9E9CE9CD9EE9EEB9EF8D3'); $this->assertEquals($iTip->getAttribute('ATTENDEE'), '*****@*****.**'); $params = $iTip->getAttribute('ATTENDEE', true); if (!$params) { throw new Horde_Compress_Exception('Could not find expected parameters.'); } $this->assertEquals($params[0]['ROLE'], 'REQ-PARTICIPANT'); $this->assertEquals($params[0]['PARTSTAT'], 'ACCEPTED'); }
public function testRecurrenceDSTSwitch() { // Recurring event starts 10/1/2011 15:00:00 EDST $l = new Horde_Test_Log(); $logger = $l->getLogger(); // Test Decoding $stream = fopen(__DIR__ . '/fixtures/dst.wbxml', 'r+'); $decoder = new Horde_ActiveSync_Wbxml_Decoder($stream); $element = $decoder->getElementStartTag(Horde_ActiveSync::SYNC_DATA); $appt = new Horde_ActiveSync_Message_Appointment(array('logger' => $logger)); $appt->decodeStream($decoder); fclose($stream); $decoder->getElementEndTag(); $rrule = $appt->getRecurrence(); // Get the next recurrence, still during EDST $next = $rrule->nextActiveRecurrence(new Horde_Date('2011-10-15')); $this->assertEquals('2011-10-15 15:00:00', (string) $next->setTimezone('America/New_York')); // Now get an occurence after the transition to EST. $next = $rrule->nextActiveRecurrence(new Horde_Date('2011-12-01')); $this->assertEquals('2011-12-10 15:00:00', (string) $next->setTimezone('America/New_York')); }
protected function _testCacheFolders() { $log = new Horde_Test_Log(); $cache = new Horde_ActiveSync_SyncCache(self::$state, 'dev123', 'mike', self::$logger->getLogger()); // First Fixture $folder = new Horde_ActiveSync_Message_Folder(array('logger' => $log->getLogger(), 'protocolversion' => Horde_ActiveSync::VERSION_TWELVEONE)); $folder->type = Horde_ActiveSync::FOLDER_TYPE_CONTACT; $folder->serverid = '@Contacts@'; $folder->_serverid = '@Contacts@'; $cache->updateFolder($folder); // Second fixture $folder = new Horde_ActiveSync_Message_Folder(array('logger' => $log->getLogger(), 'protocolversion' => Horde_ActiveSync::VERSION_TWELVEONE)); $folder->type = Horde_ActiveSync::FOLDER_TYPE_INBOX; $folder->serverid = '519422f1-4c5c-4547-946a-1701c0a8015f'; $folder->_serverid = 'INBOX'; $cache->updateFolder($folder); $expected = array('@Contacts@' => array('class' => 'Contacts', 'serverid' => '@Contacts@', 'type' => 9), '519422f1-4c5c-4547-946a-1701c0a8015f' => array('class' => 'Email', 'serverid' => 'INBOX', 'type' => 2)); $this->assertEquals($expected, $cache->getFolders()); $expected = array('class' => 'Email', 'serverid' => 'INBOX', 'type' => 2); $this->assertEquals($expected, $cache->getFolder('519422f1-4c5c-4547-946a-1701c0a8015f')); $cache->save(); }