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--EXPECTF-- 26string(3) "CET" 27int(3600000) 28string(%d) "%rEurope\/Berlin|CET%r" 29int(3600) 30string(16) "Europe/Amsterdam" 31int(3600000) 32string(16) "Europe/Amsterdam" 33int(3600) 34string(%s) "GMT+04%s5" 35int(14700000) 36string(6) "+04:05" 37int(14700) 38