Blame view
sources/3rdparty/sabre/dav/tests/Sabre/CalDAV/Issue172Test.php
3.98 KB
|
6d9380f96
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
<?php
namespace Sabre\CalDAV;
use Sabre\VObject;
use Sabre\DAV;
class Issue172Test extends \PHPUnit_Framework_TestCase {
// DateTimeZone() native name: America/Los_Angeles (GMT-8 in January)
function testBuiltInTimezoneName() {
$input = <<<HI
BEGIN:VCALENDAR
VERSION:2.0
BEGIN:VEVENT
DTSTART;TZID=America/Los_Angeles:20120118T204500
DTEND;TZID=America/Los_Angeles:20120118T214500
END:VEVENT
END:VCALENDAR
HI;
$validator = new CalendarQueryValidator();
$filters = array(
'name' => 'VCALENDAR',
'comp-filters' => array(
array(
'name' => 'VEVENT',
'comp-filters' => array(),
'prop-filters' => array(),
'is-not-defined' => false,
'time-range' => array(
'start' => new \DateTime('2012-01-18 21:00:00 GMT-08:00'),
'end' => new \DateTime('2012-01-18 21:00:00 GMT-08:00'),
),
),
),
'prop-filters' => array(),
);
$input = VObject\Reader::read($input);
$this->assertTrue($validator->validate($input,$filters));
}
// Pacific Standard Time, translates to America/Los_Angeles (GMT-8 in January)
function testOutlookTimezoneName() {
$input = <<<HI
BEGIN:VCALENDAR
VERSION:2.0
BEGIN:VTIMEZONE
TZID:Pacific Standard Time
BEGIN:STANDARD
DTSTART:16010101T030000
TZOFFSETFROM:+0200
TZOFFSETTO:+0100
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
END:STANDARD
BEGIN:DAYLIGHT
DTSTART:16010101T020000
TZOFFSETFROM:+0100
TZOFFSETTO:+0200
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=3
END:DAYLIGHT
END:VTIMEZONE
BEGIN:VEVENT
DTSTART;TZID=Pacific Standard Time:20120113T100000
DTEND;TZID=Pacific Standard Time:20120113T110000
END:VEVENT
END:VCALENDAR
HI;
$validator = new CalendarQueryValidator();
$filters = array(
'name' => 'VCALENDAR',
'comp-filters' => array(
array(
'name' => 'VEVENT',
'comp-filters' => array(),
'prop-filters' => array(),
'is-not-defined' => false,
'time-range' => array(
'start' => new \DateTime('2012-01-13 10:30:00 GMT-08:00'),
'end' => new \DateTime('2012-01-13 10:30:00 GMT-08:00'),
),
),
),
'prop-filters' => array(),
);
$input = VObject\Reader::read($input);
$this->assertTrue($validator->validate($input,$filters));
}
// X-LIC-LOCATION, translates to America/Los_Angeles (GMT-8 in January)
function testLibICalLocationName() {
$input = <<<HI
BEGIN:VCALENDAR
VERSION:2.0
BEGIN:VTIMEZONE
TZID:My own timezone name
X-LIC-LOCATION:America/Los_Angeles
BEGIN:STANDARD
DTSTART:16010101T030000
TZOFFSETFROM:+0200
TZOFFSETTO:+0100
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
END:STANDARD
BEGIN:DAYLIGHT
DTSTART:16010101T020000
TZOFFSETFROM:+0100
TZOFFSETTO:+0200
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=3
END:DAYLIGHT
END:VTIMEZONE
BEGIN:VEVENT
DTSTART;TZID=My own timezone name:20120113T100000
DTEND;TZID=My own timezone name:20120113T110000
END:VEVENT
END:VCALENDAR
HI;
$validator = new CalendarQueryValidator();
$filters = array(
'name' => 'VCALENDAR',
'comp-filters' => array(
array(
'name' => 'VEVENT',
'comp-filters' => array(),
'prop-filters' => array(),
'is-not-defined' => false,
'time-range' => array(
'start' => new \DateTime('2012-01-13 10:30:00 GMT-08:00'),
'end' => new \DateTime('2012-01-13 10:30:00 GMT-08:00'),
),
),
),
'prop-filters' => array(),
);
$input = VObject\Reader::read($input);
$this->assertTrue($validator->validate($input,$filters));
}
}
|