1--TEST-- 2datefmt_get_locale() 3--EXTENSIONS-- 4intl 5--SKIPIF-- 6<?php if (PHP_INT_SIZE != 8) die('skip 64-bit only'); 7?> 8--FILE-- 9<?php 10 11/* 12 * Test for the datefmt_get_locale function 13 */ 14 15 16function ut_main() 17{ 18 $locale_arr = array ( 19 'de-DE', 20 'sl-IT-nedis', 21 'en_UK', 22 'hi' 23 ); 24 25 $res_str = ''; 26 27 foreach( $locale_arr as $locale_entry ) 28 { 29 $res_str .= "\nCreating IntlDateFormatter with locale = $locale_entry"; 30 $fmt = ut_datefmt_create( $locale_entry , IntlDateFormatter::SHORT,IntlDateFormatter::SHORT,'America/Los_Angeles', IntlDateFormatter::GREGORIAN ); 31 $locale = ut_datefmt_get_locale( $fmt , 1); 32 $res_str .= "\nAfter call to get_locale : locale= $locale"; 33 $res_str .= "\n"; 34 } 35 $badvals = array(100, -1, 4294901761); 36 foreach($badvals as $badval) { 37 if(ut_datefmt_get_locale($fmt, $badval)) { 38 $res_str .= "datefmt_get_locale should return false for bad argument $badval\n"; 39 } 40 } 41 42 return $res_str; 43 44} 45 46include_once( 'ut_common.inc' ); 47 48// Run the test 49ut_run(); 50?> 51--EXPECT-- 52Creating IntlDateFormatter with locale = de-DE 53After call to get_locale : locale= de_DE 54 55Creating IntlDateFormatter with locale = sl-IT-nedis 56After call to get_locale : locale= sl 57 58Creating IntlDateFormatter with locale = en_UK 59After call to get_locale : locale= en 60 61Creating IntlDateFormatter with locale = hi 62After call to get_locale : locale= hi 63