1--TEST--
2IntlTimeZone::fromDateTimeZone(): basic test
3--SKIPIF--
4<?php
5if (!extension_loaded('intl'))
6	die('skip intl extension not enabled');
7--FILE--
8<?php
9ini_set("intl.error_level", E_WARNING);
10ini_set("intl.default_locale", "nl");
11date_default_timezone_set('Europe/Lisbon');
12
13$tz = IntlTimeZone::fromDateTimeZone(new DateTimeZone('Europe/Amsterdam'));
14var_dump($tz->getID(), $tz->getRawOffset());
15
16
17$dt = new DateTime('2012-01-01 00:00:00 CET');
18$dtz = $dt->getTimeZone();
19/* this is different from new DateTimeZone('CET'),
20 * which gives a Europe/Berlin timezone */
21var_dump($dtz->getName());
22$tz = IntlTimeZone::fromDateTimeZone($dtz);
23var_dump($tz->getID(), $tz->getRawOffset());
24
25
26$dt = new DateTime('2012-01-01 00:00:00 +0340');
27$dtz = $dt->getTimeZone();
28/* I don't think this timezone can be generated without a DateTime object */
29var_dump($dtz->getName());
30$tz = IntlTimeZone::fromDateTimeZone($dtz);
31var_dump($tz->getID(), $tz->getRawOffset() /* (3*60+40)*60000 */);
32--EXPECTF--
33string(16) "Europe/Amsterdam"
34int(3600000)
35string(3) "CET"
36string(3) "CET"
37int(3600000)
38string(6) "+03:40"
39string(%d) "GMT+03%s0"
40int(13200000)
41