kopia lustrzana https://github.com/friendica/SG-iCalendar
Created tests for the VEvent class.
rodzic
c5b1402ab9
commit
14f4772efe
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
require_once dirname(__FILE__).'/../common.php';
|
||||
require_once 'PHPUnit/Framework.php';
|
||||
|
||||
class VEventTest extends PHPUnit_Framework_TestCase {
|
||||
public function testParsingOfStartTimeWithTzidSet() {
|
||||
$ical = new SG_iCal();
|
||||
$timezone['tzid'] = 'America/New_York';
|
||||
$timezone['daylight'] = array(
|
||||
'tzoffsetfrom' => '-0500',
|
||||
'tzoffsetto' => '-0400',
|
||||
'tzname' => 'EDT',
|
||||
'dtstart' => '19700308T020000',
|
||||
'rrule' => 'FREQ=YEARLY;BYMONTH=3;BYDAY=2SU',
|
||||
);
|
||||
$timezone['standard'] = array(
|
||||
'tzoffsetfrom' => '-0400',
|
||||
'tzoffsetto' => '-0500',
|
||||
'tzname' => 'EST',
|
||||
'dtstart' => '19701101T020000',
|
||||
'rrule' => 'FREQ=YEARLY;BYMONTH=11;BYDAY=1SU',
|
||||
);
|
||||
$timezone2['tzid'] = 'Europe/Copenhagen';
|
||||
$timezone2['daylight'] = array(
|
||||
'tzoffsetfrom' => '+0100',
|
||||
'tzoffsetto' => '+0200',
|
||||
'tzname' => 'CEST',
|
||||
'dtstart' => '19700329T020000',
|
||||
'rrule' => 'FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU',
|
||||
);
|
||||
$timezone2['standard'] = array(
|
||||
'tzoffsetfrom' => '+0200',
|
||||
'tzoffsetto' => '+0100',
|
||||
'tzname' => 'CET',
|
||||
'dtstart' => '19701025T030000',
|
||||
'rrule' => 'FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU',
|
||||
);
|
||||
$ical->addTimeZone(new SG_iCal_VTimeZone($timezone));
|
||||
$ical->addTimeZone(new SG_iCal_VTimeZone($timezone2));
|
||||
$data['uid'] = new SG_iCal_Line('uid');
|
||||
$data['dtstart'] = new SG_iCal_Line('DTSTART;TZID=Europe/Copenhagen:20091023T2100');
|
||||
$recurrence = new SG_iCal_VEvent($data, $ical);
|
||||
date_default_timezone_set('America/New_York');
|
||||
$this->assertEquals(strtotime('20091023T1500'), $recurrence->getStart());
|
||||
}
|
||||
}
|
Ładowanie…
Reference in New Issue