コード例 #1
0
 /**
  * The vcalendar component should be capable of retrieving all of the available time zones
  */
 public function testGetTimeZonesFromCalendar()
 {
     $cal = new qCal_Component_Vcalendar();
     $useastern = new qCal_Component_Vtimezone(array('tzid' => 'US-Eastern'));
     // fake us eastern timezone
     $useastern->attach(new qCal_Component_Standard(array('dtstart' => qCal_DateTime::factory('20090913T000000Z'), 'offsetto' => new qCal_Property_Tzoffsetto('0200'), 'offsetfrom' => new qCal_Property_Tzoffsetfrom('0400'))));
     $uswestern = new qCal_Component_Vtimezone(array('tzid' => 'US-Western'));
     // fake us western timezone
     $uswestern->attach(new qCal_Component_Standard(array('dtstart' => qCal_DateTime::factory('20090913T000000Z'), 'offsetto' => new qCal_Property_Tzoffsetto('0100'), 'offsetfrom' => new qCal_Property_Tzoffsetfrom('0300'))));
     $cal->attach($useastern);
     $cal->attach($uswestern);
     $timezones = $cal->getTimeZones();
     $this->assertEqual(count($timezones), 2);
     $this->assertIdentical($timezones['US-EASTERN'], $useastern);
     $this->assertIdentical($timezones['US-WESTERN'], $uswestern);
 }