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