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)
 getMapping More...
 
 getMapping ()
 
 testExchangeMap ()
 
 testWetherMicrosoftIsStillInsane ()
 
 testUnknownExchangeId ()
 
 testWindowsTimeZone ()
 
 testTimeZoneIdentifiers ($tzid)
 getPHPTimeZoneIdentifiers More...
 
 testTimeZoneBCIdentifiers ($tzid)
 getPHPTimeZoneBCIdentifiers More...
 
 getPHPTimeZoneIdentifiers ()
 
 getPHPTimeZoneBCIdentifiers ()
 
 testTimezoneOffset ()
 
 testTimezoneFail ()
 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.

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

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.
+ Here is the call graph for this function:

◆ getPHPTimeZoneBCIdentifiers()

Sabre\VObject\TimeZoneUtilTest::getPHPTimeZoneBCIdentifiers ( )

Definition at line 201 of file TimeZoneUtilTest.php.

References Sabre\VObject\TimeZoneUtil\getIdentifiersBC().

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(), but not returned by DateTimeZone::listIdentifiers().
+ 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.

References $map.

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

◆ testCorrectTZ()

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

getMapping

Definition at line 19 of file TimeZoneUtilTest.php.

References $tz.

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  }

◆ testExchangeMap()

Sabre\VObject\TimeZoneUtilTest::testExchangeMap ( )

Definition at line 49 of file TimeZoneUtilTest.php.

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

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

◆ testFallBack()

Sabre\VObject\TimeZoneUtilTest::testFallBack ( )

Definition at line 235 of file TimeZoneUtilTest.php.

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

235  {
236 
237  $vobj = <<<HI
238 BEGIN:VCALENDAR
239 METHOD:REQUEST
240 VERSION:2.0
241 BEGIN:VTIMEZONE
242 TZID:foo
243 BEGIN:STANDARD
244 DTSTART:16010101T030000
245 TZOFFSETFROM:+0200
246 TZOFFSETTO:+0100
247 RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=10;BYDAY=-1SU
248 END:STANDARD
249 BEGIN:DAYLIGHT
250 DTSTART:16010101T020000
251 TZOFFSETFROM:+0100
252 TZOFFSETTO:+0200
253 RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=3;BYDAY=-1SU
254 END:DAYLIGHT
255 END:VTIMEZONE
256 BEGIN:VEVENT
257 DTSTAMP:20120416T092149Z
258 DTSTART;TZID="foo":20120418T1
259  00000
260 SUMMARY:Begin Unterhaltsreinigung
261 UID:040000008200E00074C5B7101A82E0080000000010DA091DC31BCD01000000000000000
262  0100000008FECD2E607780649BE5A4C9EE6418CBC
263  000
264 END:VEVENT
265 END:VCALENDAR
266 HI;
267 
269  $ex = new \DateTimeZone(date_default_timezone_get());
270  $this->assertEquals($ex->getName(), $tz->getName());
271 
272  }
static 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
static read($data, $options=0, $charset='UTF-8')
Parses a vCard or iCalendar object, and returns the top component.
Definition: Reader.php:42
+ Here is the call graph for this function:

◆ testLjubljanaBug()

Sabre\VObject\TimeZoneUtilTest::testLjubljanaBug ( )

Definition at line 274 of file TimeZoneUtilTest.php.

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

274  {
275 
276  $vobj = <<<HI
277 BEGIN:VCALENDAR
278 CALSCALE:GREGORIAN
279 PRODID:-//Ximian//NONSGML Evolution Calendar//EN
280 VERSION:2.0
281 BEGIN:VTIMEZONE
282 TZID:/freeassociation.sourceforge.net/Tzfile/Europe/Ljubljana
283 X-LIC-LOCATION:Europe/Ljubljana
284 BEGIN:STANDARD
285 TZNAME:CET
286 DTSTART:19701028T030000
287 RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
288 TZOFFSETFROM:+0200
289 TZOFFSETTO:+0100
290 END:STANDARD
291 BEGIN:DAYLIGHT
292 TZNAME:CEST
293 DTSTART:19700325T020000
294 RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=3
295 TZOFFSETFROM:+0100
296 TZOFFSETTO:+0200
297 END:DAYLIGHT
298 END:VTIMEZONE
299 BEGIN:VEVENT
300 UID:foo
301 DTSTART;TZID=/freeassociation.sourceforge.net/Tzfile/Europe/Ljubljana:
302  20121003T080000
303 DTEND;TZID=/freeassociation.sourceforge.net/Tzfile/Europe/Ljubljana:
304  20121003T083000
305 TRANSP:OPAQUE
306 SEQUENCE:2
307 SUMMARY:testing
308 CREATED:20121002T172613Z
309 LAST-MODIFIED:20121002T172613Z
310 END:VEVENT
311 END:VCALENDAR
312 
313 HI;
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  }
static 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
static read($data, $options=0, $charset='UTF-8')
Parses a vCard or iCalendar object, and returns the top component.
Definition: Reader.php:42
+ Here is the call graph for this function:

◆ testPrefixedOffsetExchangeIdentifier()

Sabre\VObject\TimeZoneUtilTest::testPrefixedOffsetExchangeIdentifier ( )

Definition at line 372 of file TimeZoneUtilTest.php.

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

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  }
static static getTimeZone($tzid, Component $vcalendar=null, $failIfUncertain=false)
This method will try to find out the correct timezone for an iCalendar date-time value.
+ Here is the call graph for this function:

◆ testTimeZoneBCIdentifiers()

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

getPHPTimeZoneBCIdentifiers

Definition at line 180 of file TimeZoneUtilTest.php.

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

180  {
181 
183  $ex = new \DateTimeZone($tzid);
184 
185  $this->assertEquals($ex->getName(), $tz->getName());
186 
187  }
static static getTimeZone($tzid, Component $vcalendar=null, $failIfUncertain=false)
This method will try to find out the correct timezone for an iCalendar date-time value.
+ Here is the call graph for this function:

◆ testTimezoneFail()

Sabre\VObject\TimeZoneUtilTest::testTimezoneFail ( )

InvalidArgumentException

Definition at line 229 of file TimeZoneUtilTest.php.

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

229  {
230 
231  $tz = TimeZoneUtil::getTimeZone('FooBar', null, true);
232 
233  }
static static getTimeZone($tzid, Component $vcalendar=null, $failIfUncertain=false)
This method will try to find out the correct timezone for an iCalendar date-time value.
+ Here is the call graph for this function:

◆ testTimeZoneIdentifiers()

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

getPHPTimeZoneIdentifiers

Definition at line 168 of file TimeZoneUtilTest.php.

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

168  {
169 
171  $ex = new \DateTimeZone($tzid);
172 
173  $this->assertEquals($ex->getName(), $tz->getName());
174 
175  }
static static getTimeZone($tzid, Component $vcalendar=null, $failIfUncertain=false)
This method will try to find out the correct timezone for an iCalendar date-time value.
+ Here is the call graph for this function:

◆ testTimezoneOffset()

Sabre\VObject\TimeZoneUtilTest::testTimezoneOffset ( )

Definition at line 213 of file TimeZoneUtilTest.php.

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

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  }
static static getTimeZone($tzid, Component $vcalendar=null, $failIfUncertain=false)
This method will try to find out the correct timezone for an iCalendar date-time value.
+ Here is the call graph for this function:

◆ testUnknownExchangeId()

Sabre\VObject\TimeZoneUtilTest::testUnknownExchangeId ( )

Definition at line 116 of file TimeZoneUtilTest.php.

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

116  {
117 
118  $vobj = <<<HI
119 BEGIN:VCALENDAR
120 METHOD:REQUEST
121 VERSION:2.0
122 BEGIN:VTIMEZONE
123 TZID:foo
124 X-MICROSOFT-CDO-TZID:2000
125 BEGIN:STANDARD
126 DTSTART:16010101T030000
127 TZOFFSETFROM:+0200
128 TZOFFSETTO:+0100
129 RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=10;BYDAY=-1SU
130 END:STANDARD
131 BEGIN:DAYLIGHT
132 DTSTART:16010101T020000
133 TZOFFSETFROM:+0100
134 TZOFFSETTO:+0200
135 RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=3;BYDAY=-1SU
136 END:DAYLIGHT
137 END:VTIMEZONE
138 BEGIN:VEVENT
139 DTSTAMP:20120416T092149Z
140 DTSTART;TZID="foo":20120418T1
141  00000
142 SUMMARY:Begin Unterhaltsreinigung
143 UID:040000008200E00074C5B7101A82E0080000000010DA091DC31BCD01000000000000000
144  0100000008FECD2E607780649BE5A4C9EE6418CBC
145 DTEND;TZID="Sarajevo, Skopje, Sofija, Vilnius, Warsaw, Zagreb":20120418T103
146  000
147 END:VEVENT
148 END:VCALENDAR
149 HI;
150 
152  $ex = new \DateTimeZone(date_default_timezone_get());
153  $this->assertEquals($ex->getName(), $tz->getName());
154 
155  }
static 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
static read($data, $options=0, $charset='UTF-8')
Parses a vCard or iCalendar object, and returns the top component.
Definition: Reader.php:42
+ Here is the call graph for this function:

◆ testWeirdSystemVLICs()

Sabre\VObject\TimeZoneUtilTest::testWeirdSystemVLICs ( )

Definition at line 322 of file TimeZoneUtilTest.php.

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

322  {
323 
324 $vobj = <<<HI
325 BEGIN:VCALENDAR
326 CALSCALE:GREGORIAN
327 PRODID:-//Ximian//NONSGML Evolution Calendar//EN
328 VERSION:2.0
329 BEGIN:VTIMEZONE
330 TZID:/freeassociation.sourceforge.net/Tzfile/SystemV/EST5EDT
331 X-LIC-LOCATION:SystemV/EST5EDT
332 BEGIN:STANDARD
333 TZNAME:EST
334 DTSTART:19701104T020000
335 RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=11
336 TZOFFSETFROM:-0400
337 TZOFFSETTO:-0500
338 END:STANDARD
339 BEGIN:DAYLIGHT
340 TZNAME:EDT
341 DTSTART:19700311T020000
342 RRULE:FREQ=YEARLY;BYDAY=2SU;BYMONTH=3
343 TZOFFSETFROM:-0500
344 TZOFFSETTO:-0400
345 END:DAYLIGHT
346 END:VTIMEZONE
347 BEGIN:VEVENT
348 UID:20121026T021107Z-6301-1000-1-0@chAir
349 DTSTAMP:20120905T172126Z
350 DTSTART;TZID=/freeassociation.sourceforge.net/Tzfile/SystemV/EST5EDT:
351  20121026T153000
352 DTEND;TZID=/freeassociation.sourceforge.net/Tzfile/SystemV/EST5EDT:
353  20121026T160000
354 TRANSP:OPAQUE
355 SEQUENCE:5
356 SUMMARY:pick up Ibby
357 CLASS:PUBLIC
358 CREATED:20121026T021108Z
359 LAST-MODIFIED:20121026T021118Z
360 X-EVOLUTION-MOVE-CALENDAR:1
361 END:VEVENT
362 END:VCALENDAR
363 HI;
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  }
static static getTimeZone($tzid, Component $vcalendar=null, $failIfUncertain=false)
This method will try to find out the correct timezone for an iCalendar date-time value.
up()
Definition: up.php:2
$vobj
Definition: rrulebench.php:21
static read($data, $options=0, $charset='UTF-8')
Parses a vCard or iCalendar object, and returns the top component.
Definition: Reader.php:42
+ Here is the call graph for this function:

◆ testWetherMicrosoftIsStillInsane()

Sabre\VObject\TimeZoneUtilTest::testWetherMicrosoftIsStillInsane ( )

Definition at line 90 of file TimeZoneUtilTest.php.

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

90  {
91 
92  $vobj = <<<HI
93 BEGIN:VCALENDAR
94 METHOD:REQUEST
95 VERSION:2.0
96 BEGIN:VTIMEZONE
97 TZID:(GMT+01.00) Sarajevo/Warsaw/Zagreb
98 X-MICROSOFT-CDO-TZID:2
99 BEGIN:STANDARD
100 DTSTART:16010101T030000
101 TZOFFSETFROM:+0200
102 TZOFFSETTO:+0100
103 RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=10;BYDAY=-1SU
104 END:STANDARD
105 END:VTIMEZONE
106 END:VCALENDAR
107 HI;
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  }
static 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
static read($data, $options=0, $charset='UTF-8')
Parses a vCard or iCalendar object, and returns the top component.
Definition: Reader.php:42
+ Here is the call graph for this function:

◆ testWindowsTimeZone()

Sabre\VObject\TimeZoneUtilTest::testWindowsTimeZone ( )

Definition at line 157 of file TimeZoneUtilTest.php.

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

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  }
static static getTimeZone($tzid, Component $vcalendar=null, $failIfUncertain=false)
This method will try to find out the correct timezone for an iCalendar date-time value.
+ Here is the call graph for this function:

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