1--TEST--
2numfmt_get_locale()
3--SKIPIF--
4<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
5<?php if (version_compare(INTL_ICU_VERSION, '51.2') < 0) die('skip for ICU >= 51.2'); ?>
6<?php if (version_compare(INTL_ICU_VERSION, '58.1') >=  0) die('skip for ICU < 58.1'); ?>
7--FILE--
8<?php
9
10/*
11 * Get locale.
12 */
13
14function ut_main()
15{
16    $locales = array(
17        'en_UK',
18        'en_US@California',
19        'fr_CA',
20    );
21
22    $loc_types = array(
23        Locale::ACTUAL_LOCALE    => 'actual',
24        Locale::VALID_LOCALE     => 'valid',
25    );
26
27    $res_str = '';
28
29    foreach( $locales as $locale )
30    {
31        $fmt = ut_nfmt_create( $locale, NumberFormatter::DECIMAL );
32        $res_str .= "$locale: ";
33        foreach( $loc_types as $loc_type => $loc_type_name )
34            $res_str .= sprintf( " %s=%s",
35            $loc_type_name,
36            dump( ut_nfmt_get_locale( $fmt, $loc_type ) ) );
37        $res_str .= "\n";
38    }
39
40    return $res_str;
41}
42
43include_once( 'ut_common.inc' );
44
45// Run the test
46ut_run();
47?>
48--EXPECT--
49en_UK:  actual='en' valid='en'
50en_US@California:  actual='en' valid='en'
51fr_CA:  actual='fr' valid='fr_CA'
52