public function testConversionTwo() { $owa = new Horde_Kolab_FreeBusy_Freebusy_Helper_Owa(fopen(__DIR__ . '/../../../fixtures/owa_freebusy.xml', 'r')); $result = $owa->convert(new Horde_Date('2009-09-25T00:00:00-07:00'), new Horde_Date('2009-09-26T00:00:00-07:00'), 30); $this->assertEquals(array(0 => '2009-09-25 03:00:00 - 2009-09-25 05:00:00: busy', 1 => '2009-09-25 12:30:00 - 2009-09-25 14:30:00: tentative'), $this->_readable($result['*****@*****.**'])); }
/** * Lists all events in the given time range. * * @param Horde_Date $startDate Start of range date object. * @param Horde_Date $endDate End of range data object. * * @return array Events in the given time range. * * @throws Horde_Kolab_FreeBusy_Exception If retrieving the events failed. */ public function listEvents(Horde_Date $startDate, Horde_Date $endDate) { $url = $this->_params['url'] . '/public/?cmd=freebusy' . '&start=' . $startDate->format('c') . '&end=' . $endDate->format('c') . '&interval=' . $this->_params['interval'] . '&u=SMTP:' . $this->_owner->getOwner(); $response = $this->_client->get($url, array('User-Agent' => 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.1.4322)')); if ($response->code !== 200) { throw new Horde_Kolab_FreeBusy_Exception_NotFound(sprintf('Unable to fetch free/busy information from %s', $url)); } $owa = new Horde_Kolab_FreeBusy_Freebusy_Helper_Owa($response->getStream()); $result = $owa->convert($startDate, $endDate, $this->_params['interval']); if (!isset($result[$this->_owner->getOwner()])) { return array(); } $events = array(); foreach ($result[$this->_owner->getOwner()] as $item) { $events[] = new Horde_Kolab_FreeBusy_Object_Event($item); } return $events; }