xref: /PHP-7.1/ext/intl/tests/locale_accept.phpt (revision 7af945e2)
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		array()
23	);
24
25     foreach($http_acc as $http) {
26		$res = ut_loc_accept_http($http);
27		$res_str .= @"Accepting $http: $res\n";
28	}
29
30    return $res_str;
31}
32
33include_once( 'ut_common.inc' );
34ut_run();
35
36?>
37--EXPECTF--
38Warning: Locale::acceptFromHttp() expects parameter 1 to be string, array given in %s on line %d
39
40Warning: locale_accept_from_http() expects parameter 1 to be string, array given in %s on line %d
41Accepting en-us,en;q=0.5: en_US
42Accepting da, en-gb;q=0.8, en;q=0.7: da
43Accepting zh, en-us;q=0.8, en;q=0.7: zh
44Accepting xx, fr-FR;q=0.3, de-DE;q=0.5: de_DE
45Accepting none:
46Accepting Array:
47