1--TEST--
2get_locale() icu >= 4.8
3--SKIPIF--
4<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
5<?php if(version_compare(INTL_ICU_VERSION, '4.8') < 0) print 'skip'; ?>
6--FILE--
7<?php
8
9/*
10 * Try to specify valid and invalid locale types when getting locale.
11 */
12
13function ut_main()
14{
15    $locales = array(
16        Locale::VALID_LOCALE,
17        Locale::ACTUAL_LOCALE,
18        100,
19        -100,
20        -9999999999999,
21        9999999999999,
22        1.2,
23    );
24
25    $coll = ut_coll_create( 'en_US' );
26    $res_str = '';
27
28    foreach( $locales as $locale )
29    {
30        $rc = ut_coll_get_locale( $coll, $locale );
31
32        $res_str .= sprintf(
33            "Locale of type %s is %s\n",
34            dump( $locale ),
35            dump( $rc ) );
36    }
37
38    return $res_str . "\n";
39}
40
41include_once( 'ut_common.inc' );
42ut_run();
43?>
44--EXPECT--
45Locale of type 1 is 'en_US'
46Locale of type 0 is 'root'
47Locale of type 100 is false
48Locale of type -100 is false
49Locale of type -9999999999999 is false
50Locale of type 9999999999999 is false
51Locale of type 1.2 is 'en_US'
52