1--TEST-- 2Test timezone_name_from_abbr() function : basic functionality 3--FILE-- 4<?php 5echo "*** Testing timezone_name_from_abbr() : basic functionality ***\n"; 6 7//Set the default time zone 8date_default_timezone_set("Europe/London"); 9 10echo "-- Tests with special cases first - no lookup needed --\n"; 11var_dump( timezone_name_from_abbr("GMT") ); 12var_dump( timezone_name_from_abbr("UTC") ); 13 14echo "-- Lookup with just name --\n"; 15var_dump( timezone_name_from_abbr("CET") ); 16var_dump( timezone_name_from_abbr("EDT") ); 17 18echo "-- Lookup with name and offset--\n"; 19var_dump( timezone_name_from_abbr("ADT", -10800) ); 20var_dump( timezone_name_from_abbr("ADT", 14400) ); 21 22echo "-- Tests without valid name - uses gmtOffset and isdst to find match --\n"; 23var_dump( timezone_name_from_abbr("", 3600, 1) ); 24var_dump( timezone_name_from_abbr("FOO", -7200, 1) ); 25var_dump( timezone_name_from_abbr("", -14400, 1) ); 26var_dump( timezone_name_from_abbr("", -14400, 0) ); 27 28echo "-- Tests with invalid offsets --\n"; 29var_dump( timezone_name_from_abbr("", 5400) ); // offset = 1.5 hrs 30var_dump( timezone_name_from_abbr("", 62400) ); // offset = 24 hrs 31?> 32--EXPECT-- 33*** Testing timezone_name_from_abbr() : basic functionality *** 34-- Tests with special cases first - no lookup needed -- 35string(3) "UTC" 36string(3) "UTC" 37-- Lookup with just name -- 38string(13) "Europe/Berlin" 39string(16) "America/New_York" 40-- Lookup with name and offset-- 41string(15) "America/Halifax" 42string(15) "America/Halifax" 43-- Tests without valid name - uses gmtOffset and isdst to find match -- 44string(13) "Europe/London" 45string(17) "America/Sao_Paulo" 46string(16) "America/New_York" 47string(15) "America/Halifax" 48-- Tests with invalid offsets -- 49bool(false) 50bool(false) 51