1--TEST-- 2IntlTimeZone::toDateTimeZone(): 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 13function do_test(IntlTimeZone $tz, $proc = false) { 14 var_dump($tz->getID(), $tz->getRawOffset()); 15 if (!$proc) 16 $dtz = $tz->toDateTimeZone(); 17 else 18 $dtz = intltz_to_date_time_zone($tz); 19 var_dump($dtz->getName(), $dtz->getOffset(new DateTime('2012-01-01 00:00:00'))); 20} 21 22do_test(IntlTimeZone::createTimeZone('CET')); 23do_test(IntlTimeZone::createTimeZone('Europe/Amsterdam')); 24do_test(IntlTimeZone::createTimeZone('GMT+0405'), true); 25 26--EXPECTF-- 27string(3) "CET" 28int(3600000) 29string(%d) "%rEurope\/Berlin|CET%r" 30int(3600) 31string(16) "Europe/Amsterdam" 32int(3600000) 33string(16) "Europe/Amsterdam" 34int(3600) 35string(%s) "GMT+04%s5" 36int(14700000) 37string(6) "+04:05" 38int(14700) 39