ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Sabre\VObject\TimeZoneUtilTest Class Reference
+ Inheritance diagram for Sabre\VObject\TimeZoneUtilTest:
+ Collaboration diagram for Sabre\VObject\TimeZoneUtilTest:

Public Member Functions

 setUp ()
 
 testCorrectTZ ($timezoneName)
 @dataProvider getMapping More...
 
 getMapping ()
 
 testExchangeMap ()
 
 testWetherMicrosoftIsStillInsane ()
 
 testUnknownExchangeId ()
 
 testWindowsTimeZone ()
 
 testTimeZoneIdentifiers ($tzid)
 @dataProvider getPHPTimeZoneIdentifiers More...
 
 testTimeZoneBCIdentifiers ($tzid)
 @dataProvider getPHPTimeZoneBCIdentifiers More...
 
 getPHPTimeZoneIdentifiers ()
 
 getPHPTimeZoneBCIdentifiers ()
 
 testTimezoneOffset ()
 
 testTimezoneFail ()
 @expectedException InvalidArgumentException More...
 
 testFallBack ()
 
 testLjubljanaBug ()
 
 testWeirdSystemVLICs ()
 
 testPrefixedOffsetExchangeIdentifier ()
 

Detailed Description

Definition at line 7 of file TimeZoneUtilTest.php.

Member Function Documentation

◆ getMapping()

Sabre\VObject\TimeZoneUtilTest::getMapping ( )

Definition at line 35 of file TimeZoneUtilTest.php.

35 {
36
38
39 // PHPUNit requires an array of arrays
40 return array_map(
41 function($value) {
42 return [$value];
43 },
45 );
46
47 }
static loadTzMaps()
This method will load in all the tz mapping information, if it's not yet done.

References Sabre\VObject\TimeZoneUtil\$map, and Sabre\VObject\TimeZoneUtil\loadTzMaps().

+ Here is the call graph for this function:

◆ getPHPTimeZoneBCIdentifiers()

Sabre\VObject\TimeZoneUtilTest::getPHPTimeZoneBCIdentifiers ( )

Definition at line 201 of file TimeZoneUtilTest.php.

201 {
202
203 // PHPUNit requires an array of arrays
204 return array_map(
205 function($value) {
206 return [$value];
207 },
209 );
210
211 }
static getIdentifiersBC()
This method returns an array of timezone identifiers, that are supported by DateTimeZone(),...

References Sabre\VObject\TimeZoneUtil\getIdentifiersBC().

+ Here is the call graph for this function:

◆ getPHPTimeZoneIdentifiers()

Sabre\VObject\TimeZoneUtilTest::getPHPTimeZoneIdentifiers ( )

Definition at line 189 of file TimeZoneUtilTest.php.

189 {
190
191 // PHPUNit requires an array of arrays
192 return array_map(
193 function($value) {
194 return [$value];
195 },
196 \DateTimeZone::listIdentifiers()
197 );
198
199 }

◆ setUp()

Sabre\VObject\TimeZoneUtilTest::setUp ( )

Definition at line 9 of file TimeZoneUtilTest.php.

9 {
10
11 // clearning the tz cache
12 TimezoneUtil::$map = null;
13
14 }

References $map.

◆ testCorrectTZ()

Sabre\VObject\TimeZoneUtilTest::testCorrectTZ (   $timezoneName)

@dataProvider getMapping

Definition at line 19 of file TimeZoneUtilTest.php.

19 {
20
21 try {
22 $tz = new \DateTimeZone($timezoneName);
23 $this->assertInstanceOf('DateTimeZone', $tz);
24 } catch (\Exception $e) {
25 if (strpos($e->getMessage(), "Unknown or bad timezone") !== false) {
26 $this->markTestSkipped($timezoneName . ' is not (yet) supported in this PHP version. Update pecl/timezonedb');
27 } else {
28 throw $e;
29 }
30
31 }
32
33 }

References $tz.

◆ testExchangeMap()

Sabre\VObject\TimeZoneUtilTest::testExchangeMap ( )

Definition at line 49 of file TimeZoneUtilTest.php.

49 {
50
51 $vobj = <<<HI
52BEGIN:VCALENDAR
53METHOD:REQUEST
54VERSION:2.0
55BEGIN:VTIMEZONE
56TZID:foo
57X-MICROSOFT-CDO-TZID:2
58BEGIN:STANDARD
59DTSTART:16010101T030000
60TZOFFSETFROM:+0200
61TZOFFSETTO:+0100
62RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=10;BYDAY=-1SU
63END:STANDARD
64BEGIN:DAYLIGHT
65DTSTART:16010101T020000
66TZOFFSETFROM:+0100
67TZOFFSETTO:+0200
68RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=3;BYDAY=-1SU
69END:DAYLIGHT
70END:VTIMEZONE
71BEGIN:VEVENT
72DTSTAMP:20120416T092149Z
73DTSTART;TZID="foo":20120418T1
74 00000
75SUMMARY:Begin Unterhaltsreinigung
76UID:040000008200E00074C5B7101A82E0080000000010DA091DC31BCD01000000000000000
77 0100000008FECD2E607780649BE5A4C9EE6418CBC
78 000
79END:VEVENT
80END:VCALENDAR
81HI;
82
84 $ex = new \DateTimeZone('Europe/Lisbon');
85
86 $this->assertEquals($ex->getName(), $tz->getName());
87
88 }
static read($data, $options=0, $charset='UTF-8')
Parses a vCard or iCalendar object, and returns the top component.
Definition: Reader.php:42
static getTimeZone($tzid, Component $vcalendar=null, $failIfUncertain=false)
This method will try to find out the correct timezone for an iCalendar date-time value.
$vobj
Definition: rrulebench.php:21

References $tz, $vobj, Sabre\VObject\TimeZoneUtil\getTimeZone(), and Sabre\VObject\Reader\read().

+ Here is the call graph for this function:

◆ testFallBack()

Sabre\VObject\TimeZoneUtilTest::testFallBack ( )

Definition at line 235 of file TimeZoneUtilTest.php.

235 {
236
237 $vobj = <<<HI
238BEGIN:VCALENDAR
239METHOD:REQUEST
240VERSION:2.0
241BEGIN:VTIMEZONE
242TZID:foo
243BEGIN:STANDARD
244DTSTART:16010101T030000
245TZOFFSETFROM:+0200
246TZOFFSETTO:+0100
247RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=10;BYDAY=-1SU
248END:STANDARD
249BEGIN:DAYLIGHT
250DTSTART:16010101T020000
251TZOFFSETFROM:+0100
252TZOFFSETTO:+0200
253RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=3;BYDAY=-1SU
254END:DAYLIGHT
255END:VTIMEZONE
256BEGIN:VEVENT
257DTSTAMP:20120416T092149Z
258DTSTART;TZID="foo":20120418T1
259 00000
260SUMMARY:Begin Unterhaltsreinigung
261UID:040000008200E00074C5B7101A82E0080000000010DA091DC31BCD01000000000000000
262 0100000008FECD2E607780649BE5A4C9EE6418CBC
263 000
264END:VEVENT
265END:VCALENDAR
266HI;
267
269 $ex = new \DateTimeZone(date_default_timezone_get());
270 $this->assertEquals($ex->getName(), $tz->getName());
271
272 }

References $tz, $vobj, Sabre\VObject\TimeZoneUtil\getTimeZone(), and Sabre\VObject\Reader\read().

+ Here is the call graph for this function:

◆ testLjubljanaBug()

Sabre\VObject\TimeZoneUtilTest::testLjubljanaBug ( )

Definition at line 274 of file TimeZoneUtilTest.php.

274 {
275
276 $vobj = <<<HI
277BEGIN:VCALENDAR
278CALSCALE:GREGORIAN
279PRODID:-//Ximian//NONSGML Evolution Calendar//EN
280VERSION:2.0
281BEGIN:VTIMEZONE
282TZID:/freeassociation.sourceforge.net/Tzfile/Europe/Ljubljana
283X-LIC-LOCATION:Europe/Ljubljana
284BEGIN:STANDARD
285TZNAME:CET
286DTSTART:19701028T030000
287RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
288TZOFFSETFROM:+0200
289TZOFFSETTO:+0100
290END:STANDARD
291BEGIN:DAYLIGHT
292TZNAME:CEST
293DTSTART:19700325T020000
294RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=3
295TZOFFSETFROM:+0100
296TZOFFSETTO:+0200
297END:DAYLIGHT
298END:VTIMEZONE
299BEGIN:VEVENT
300UID:foo
301DTSTART;TZID=/freeassociation.sourceforge.net/Tzfile/Europe/Ljubljana:
302 20121003T080000
303DTEND;TZID=/freeassociation.sourceforge.net/Tzfile/Europe/Ljubljana:
304 20121003T083000
305TRANSP:OPAQUE
306SEQUENCE:2
307SUMMARY:testing
308CREATED:20121002T172613Z
309LAST-MODIFIED:20121002T172613Z
310END:VEVENT
311END:VCALENDAR
312
313HI;
314
315
316 $tz = TimeZoneUtil::getTimeZone('/freeassociation.sourceforge.net/Tzfile/Europe/Ljubljana', Reader::read($vobj));
317 $ex = new \DateTimeZone('Europe/Ljubljana');
318 $this->assertEquals($ex->getName(), $tz->getName());
319
320 }

References $tz, $vobj, Sabre\VObject\TimeZoneUtil\getTimeZone(), and Sabre\VObject\Reader\read().

+ Here is the call graph for this function:

◆ testPrefixedOffsetExchangeIdentifier()

Sabre\VObject\TimeZoneUtilTest::testPrefixedOffsetExchangeIdentifier ( )

Definition at line 372 of file TimeZoneUtilTest.php.

373 {
374 $tz = TimeZoneUtil::getTimeZone('(UTC-05:00) Eastern Time (US & Canada)');
375 $ex = new \DateTimeZone('America/New_York');
376 $this->assertEquals($ex->getName(), $tz->getName());
377 }

References $tz, and Sabre\VObject\TimeZoneUtil\getTimeZone().

+ Here is the call graph for this function:

◆ testTimeZoneBCIdentifiers()

Sabre\VObject\TimeZoneUtilTest::testTimeZoneBCIdentifiers (   $tzid)

@dataProvider getPHPTimeZoneBCIdentifiers

Definition at line 180 of file TimeZoneUtilTest.php.

180 {
181
183 $ex = new \DateTimeZone($tzid);
184
185 $this->assertEquals($ex->getName(), $tz->getName());
186
187 }

References $tz, and Sabre\VObject\TimeZoneUtil\getTimeZone().

+ Here is the call graph for this function:

◆ testTimezoneFail()

Sabre\VObject\TimeZoneUtilTest::testTimezoneFail ( )

@expectedException InvalidArgumentException

Definition at line 229 of file TimeZoneUtilTest.php.

229 {
230
231 $tz = TimeZoneUtil::getTimeZone('FooBar', null, true);
232
233 }

References $tz, and Sabre\VObject\TimeZoneUtil\getTimeZone().

+ Here is the call graph for this function:

◆ testTimeZoneIdentifiers()

Sabre\VObject\TimeZoneUtilTest::testTimeZoneIdentifiers (   $tzid)

@dataProvider getPHPTimeZoneIdentifiers

Definition at line 168 of file TimeZoneUtilTest.php.

168 {
169
171 $ex = new \DateTimeZone($tzid);
172
173 $this->assertEquals($ex->getName(), $tz->getName());
174
175 }

References $tz, and Sabre\VObject\TimeZoneUtil\getTimeZone().

+ Here is the call graph for this function:

◆ testTimezoneOffset()

Sabre\VObject\TimeZoneUtilTest::testTimezoneOffset ( )

Definition at line 213 of file TimeZoneUtilTest.php.

213 {
214
215 $tz = TimeZoneUtil::getTimeZone('GMT-0400', null, true);
216
217 if (version_compare(PHP_VERSION, '5.5.10', '>=') && !defined('HHVM_VERSION')) {
218 $ex = new \DateTimeZone('-04:00');
219 } else {
220 $ex = new \DateTimeZone('Etc/GMT-4');
221 }
222 $this->assertEquals($ex->getName(), $tz->getName());
223
224 }

References $tz, and Sabre\VObject\TimeZoneUtil\getTimeZone().

+ Here is the call graph for this function:

◆ testUnknownExchangeId()

Sabre\VObject\TimeZoneUtilTest::testUnknownExchangeId ( )

Definition at line 116 of file TimeZoneUtilTest.php.

116 {
117
118 $vobj = <<<HI
119BEGIN:VCALENDAR
120METHOD:REQUEST
121VERSION:2.0
122BEGIN:VTIMEZONE
123TZID:foo
124X-MICROSOFT-CDO-TZID:2000
125BEGIN:STANDARD
126DTSTART:16010101T030000
127TZOFFSETFROM:+0200
128TZOFFSETTO:+0100
129RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=10;BYDAY=-1SU
130END:STANDARD
131BEGIN:DAYLIGHT
132DTSTART:16010101T020000
133TZOFFSETFROM:+0100
134TZOFFSETTO:+0200
135RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=3;BYDAY=-1SU
136END:DAYLIGHT
137END:VTIMEZONE
138BEGIN:VEVENT
139DTSTAMP:20120416T092149Z
140DTSTART;TZID="foo":20120418T1
141 00000
142SUMMARY:Begin Unterhaltsreinigung
143UID:040000008200E00074C5B7101A82E0080000000010DA091DC31BCD01000000000000000
144 0100000008FECD2E607780649BE5A4C9EE6418CBC
145DTEND;TZID="Sarajevo, Skopje, Sofija, Vilnius, Warsaw, Zagreb":20120418T103
146 000
147END:VEVENT
148END:VCALENDAR
149HI;
150
152 $ex = new \DateTimeZone(date_default_timezone_get());
153 $this->assertEquals($ex->getName(), $tz->getName());
154
155 }

References $tz, $vobj, Sabre\VObject\TimeZoneUtil\getTimeZone(), and Sabre\VObject\Reader\read().

+ Here is the call graph for this function:

◆ testWeirdSystemVLICs()

Sabre\VObject\TimeZoneUtilTest::testWeirdSystemVLICs ( )

Definition at line 322 of file TimeZoneUtilTest.php.

322 {
323
324$vobj = <<<HI
325BEGIN:VCALENDAR
326CALSCALE:GREGORIAN
327PRODID:-//Ximian//NONSGML Evolution Calendar//EN
328VERSION:2.0
329BEGIN:VTIMEZONE
330TZID:/freeassociation.sourceforge.net/Tzfile/SystemV/EST5EDT
331X-LIC-LOCATION:SystemV/EST5EDT
332BEGIN:STANDARD
333TZNAME:EST
334DTSTART:19701104T020000
335RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=11
336TZOFFSETFROM:-0400
337TZOFFSETTO:-0500
338END:STANDARD
339BEGIN:DAYLIGHT
340TZNAME:EDT
341DTSTART:19700311T020000
342RRULE:FREQ=YEARLY;BYDAY=2SU;BYMONTH=3
343TZOFFSETFROM:-0500
344TZOFFSETTO:-0400
345END:DAYLIGHT
346END:VTIMEZONE
347BEGIN:VEVENT
348UID:20121026T021107Z-6301-1000-1-0@chAir
349DTSTAMP:20120905T172126Z
350DTSTART;TZID=/freeassociation.sourceforge.net/Tzfile/SystemV/EST5EDT:
351 20121026T153000
352DTEND;TZID=/freeassociation.sourceforge.net/Tzfile/SystemV/EST5EDT:
353 20121026T160000
354TRANSP:OPAQUE
355SEQUENCE:5
356SUMMARY:pick up Ibby
357CLASS:PUBLIC
358CREATED:20121026T021108Z
359LAST-MODIFIED:20121026T021118Z
360X-EVOLUTION-MOVE-CALENDAR:1
361END:VEVENT
362END:VCALENDAR
363HI;
364
365 $tz = TimeZoneUtil::getTimeZone('/freeassociation.sourceforge.net/Tzfile/SystemV/EST5EDT', Reader::read($vobj), true);
366 $ex = new \DateTimeZone('America/New_York');
367 $this->assertEquals($ex->getName(), $tz->getName());
368
369 }
up()
Definition: up.php:2

References $tz, $vobj, Sabre\VObject\TimeZoneUtil\getTimeZone(), Sabre\VObject\Reader\read(), and up().

+ Here is the call graph for this function:

◆ testWetherMicrosoftIsStillInsane()

Sabre\VObject\TimeZoneUtilTest::testWetherMicrosoftIsStillInsane ( )

Definition at line 90 of file TimeZoneUtilTest.php.

90 {
91
92 $vobj = <<<HI
93BEGIN:VCALENDAR
94METHOD:REQUEST
95VERSION:2.0
96BEGIN:VTIMEZONE
97TZID:(GMT+01.00) Sarajevo/Warsaw/Zagreb
98X-MICROSOFT-CDO-TZID:2
99BEGIN:STANDARD
100DTSTART:16010101T030000
101TZOFFSETFROM:+0200
102TZOFFSETTO:+0100
103RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=10;BYDAY=-1SU
104END:STANDARD
105END:VTIMEZONE
106END:VCALENDAR
107HI;
108
109 $tz = TimeZoneUtil::getTimeZone('(GMT+01.00) Sarajevo/Warsaw/Zagreb', Reader::read($vobj));
110 $ex = new \DateTimeZone('Europe/Sarajevo');
111
112 $this->assertEquals($ex->getName(), $tz->getName());
113
114 }

References $tz, $vobj, Sabre\VObject\TimeZoneUtil\getTimeZone(), and Sabre\VObject\Reader\read().

+ Here is the call graph for this function:

◆ testWindowsTimeZone()

Sabre\VObject\TimeZoneUtilTest::testWindowsTimeZone ( )

Definition at line 157 of file TimeZoneUtilTest.php.

157 {
158
159 $tz = TimeZoneUtil::getTimeZone('Eastern Standard Time');
160 $ex = new \DateTimeZone('America/New_York');
161 $this->assertEquals($ex->getName(), $tz->getName());
162
163 }

References $tz, and Sabre\VObject\TimeZoneUtil\getTimeZone().

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: