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