xref: /PHP-8.0/ext/intl/tests/locale_accept.phpt (revision f8d79582)
1--TEST--
2locale_accept_from_http
3--SKIPIF--
4<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
5--FILE--
6<?php
7
8/*
9 * Try parsing different Locales
10 * with Procedural and Object methods.
11 */
12
13function ut_main()
14{
15    $res_str = "";
16    $http_acc = array(
17        'en-us,en;q=0.5',
18        'da, en-gb;q=0.8, en;q=0.7',
19        'zh, en-us;q=0.8, en;q=0.7',
20        'xx, fr-FR;q=0.3, de-DE;q=0.5',
21        'none',
22    );
23
24     foreach($http_acc as $http) {
25        $res = ut_loc_accept_http($http);
26        $res_str .= @"Accepting $http: $res\n";
27    }
28
29    return $res_str;
30}
31
32include_once( 'ut_common.inc' );
33ut_run();
34
35?>
36--EXPECT--
37Accepting en-us,en;q=0.5: en_US
38Accepting da, en-gb;q=0.8, en;q=0.7: da
39Accepting zh, en-us;q=0.8, en;q=0.7: zh
40Accepting xx, fr-FR;q=0.3, de-DE;q=0.5: de_DE
41Accepting none:
42