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