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