5use PHPUnit\Framework\TestCase;
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');
59DTSTART:16010101T030000
62RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=10;BYDAY=-1SU
65DTSTART:16010101T020000
68RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=3;BYDAY=-1SU
72DTSTAMP:20120416T092149Z
73DTSTART;TZID=
"foo":20120418T1
75SUMMARY:Begin Unterhaltsreinigung
76UID:040000008200E00074C5B7101A82E0080000000010DA091DC31BCD01000000000000000
77 0100000008FECD2E607780649BE5A4C9EE6418CBC
84 $ex = new \DateTimeZone(
'Europe/Lisbon');
86 $this->assertEquals($ex->getName(),
$tz->getName());
97TZID:(GMT+01.00) Sarajevo/Warsaw/Zagreb
100DTSTART:16010101T030000
103RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=10;BYDAY=-1SU
110 $ex = new \DateTimeZone(
'Europe/Sarajevo');
112 $this->assertEquals($ex->getName(),
$tz->getName());
124X-MICROSOFT-CDO-TZID:2000
126DTSTART:16010101T030000
129RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=10;BYDAY=-1SU
132DTSTART:16010101T020000
135RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=3;BYDAY=-1SU
139DTSTAMP:20120416T092149Z
140DTSTART;TZID=
"foo":20120418T1
142SUMMARY:Begin Unterhaltsreinigung
143UID:040000008200E00074C5B7101A82E0080000000010DA091DC31BCD01000000000000000
144 0100000008FECD2E607780649BE5A4C9EE6418CBC
145DTEND;TZID=
"Sarajevo, Skopje, Sofija, Vilnius, Warsaw, Zagreb":20120418T103
152 $ex = new \DateTimeZone(date_default_timezone_get());
153 $this->assertEquals($ex->getName(),
$tz->getName());
160 $ex = new \DateTimeZone(
'America/New_York');
161 $this->assertEquals($ex->getName(),
$tz->getName());
171 $ex = new \DateTimeZone($tzid);
173 $this->assertEquals($ex->getName(),
$tz->getName());
183 $ex = new \DateTimeZone($tzid);
185 $this->assertEquals($ex->getName(),
$tz->getName());
196 \DateTimeZone::listIdentifiers()
217 if (version_compare(PHP_VERSION,
'5.5.10',
'>=') && !defined(
'HHVM_VERSION')) {
218 $ex = new \DateTimeZone(
'-04:00');
220 $ex = new \DateTimeZone(
'Etc/GMT-4');
222 $this->assertEquals($ex->getName(),
$tz->getName());
244DTSTART:16010101T030000
247RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=10;BYDAY=-1SU
250DTSTART:16010101T020000
253RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=3;BYDAY=-1SU
257DTSTAMP:20120416T092149Z
258DTSTART;TZID=
"foo":20120418T1
260SUMMARY:Begin Unterhaltsreinigung
261UID:040000008200E00074C5B7101A82E0080000000010DA091DC31BCD01000000000000000
262 0100000008FECD2E607780649BE5A4C9EE6418CBC
269 $ex = new \DateTimeZone(date_default_timezone_get());
270 $this->assertEquals($ex->getName(),
$tz->getName());
282TZID:/freeassociation.sourceforge.net/Tzfile/Europe/Ljubljana
283X-LIC-LOCATION:Europe/Ljubljana
286DTSTART:19701028T030000
287RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
293DTSTART:19700325T020000
294RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=3
301DTSTART;TZID=/freeassociation.sourceforge.net/Tzfile/Europe/Ljubljana:
303DTEND;TZID=/freeassociation.sourceforge.net/Tzfile/Europe/Ljubljana:
308CREATED:20121002T172613Z
309LAST-MODIFIED:20121002T172613Z
317 $ex = new \DateTimeZone(
'Europe/Ljubljana');
318 $this->assertEquals($ex->getName(),
$tz->getName());
330TZID:/freeassociation.sourceforge.net/Tzfile/SystemV/EST5EDT
331X-LIC-LOCATION:SystemV/EST5EDT
334DTSTART:19701104T020000
335RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=11
341DTSTART:19700311T020000
342RRULE:FREQ=YEARLY;BYDAY=2SU;BYMONTH=3
348UID:20121026T021107Z-6301-1000-1-0@chAir
349DTSTAMP:20120905T172126Z
350DTSTART;TZID=/freeassociation.sourceforge.net/Tzfile/SystemV/EST5EDT:
352DTEND;TZID=/freeassociation.sourceforge.net/Tzfile/SystemV/EST5EDT:
358CREATED:20121026T021108Z
359LAST-MODIFIED:20121026T021118Z
360X-EVOLUTION-MOVE-CALENDAR:1
366 $ex = new \DateTimeZone(
'America/New_York');
367 $this->assertEquals($ex->getName(),
$tz->getName());
375 $ex = new \DateTimeZone(
'America/New_York');
376 $this->assertEquals($ex->getName(),
$tz->getName());
An exception for terminatinating execution or to throw for unit testing.
static read($data, $options=0, $charset='UTF-8')
Parses a vCard or iCalendar object, and returns the top component.
testWetherMicrosoftIsStillInsane()
testTimezoneFail()
@expectedException InvalidArgumentException
getPHPTimeZoneIdentifiers()
testTimeZoneIdentifiers($tzid)
@dataProvider getPHPTimeZoneIdentifiers
testPrefixedOffsetExchangeIdentifier()
testTimeZoneBCIdentifiers($tzid)
@dataProvider getPHPTimeZoneBCIdentifiers
getPHPTimeZoneBCIdentifiers()
testCorrectTZ($timezoneName)
@dataProvider getMapping
static loadTzMaps()
This method will load in all the tz mapping information, if it's not yet done.
static getIdentifiersBC()
This method returns an array of timezone identifiers, that are supported by DateTimeZone(),...
static getTimeZone($tzid, Component $vcalendar=null, $failIfUncertain=false)
This method will try to find out the correct timezone for an iCalendar date-time value.