Annotation of embedaddon/php/ext/intl/tests/msgfmt_fail.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: msgfmt creation failures
3: --SKIPIF--
4: <?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
5: --FILE--
6: <?php
7:
8: function err($fmt) {
9: if(!$fmt) {
10: echo var_export(intl_get_error_message(), true)."\n";
11: }
12: }
13:
14: function crt($t, $l, $s) {
15: switch(true) {
16: case $t == "O":
17: return new MessageFormatter($l, $s);
18: break;
19: case $t == "C":
20: return MessageFormatter::create($l, $s);
21: break;
22: case $t == "P":
23: return msgfmt_create($l, $s);
24: break;
25: }
26: }
27:
28: $args = array(
29: array(null, null),
30: array("whatever", "{0,whatever}"),
31: array(array(), array()),
32: array("en", "{0,choice}"),
33: array("fr", "{0,"),
34: array("en_US", "\xD0"),
35: );
36:
37: $fmt = new MessageFormatter();
38: err($fmt);
39: $fmt = msgfmt_create();
40: err($fmt);
41: $fmt = MessageFormatter::create();
42: err($fmt);
43: $fmt = new MessageFormatter('en');
44: err($fmt);
45: $fmt = msgfmt_create('en');
46: err($fmt);
47: $fmt = MessageFormatter::create('en');
48: err($fmt);
49:
50: foreach($args as $arg) {
51: $fmt = crt("O", $arg[0], $arg[1]);
52: err($fmt);
53: $fmt = crt("C", $arg[0], $arg[1]);
54: err($fmt);
55: $fmt = crt("P", $arg[0], $arg[1]);
56: err($fmt);
57: }
58:
59: ?>
60: --EXPECTF--
61: Warning: MessageFormatter::__construct() expects exactly 2 parameters, 0 given in %s on line %d
62: 'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
63:
64: Warning: msgfmt_create() expects exactly 2 parameters, 0 given in %s on line %d
65: 'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
66:
67: Warning: MessageFormatter::create() expects exactly 2 parameters, 0 given in %s on line %d
68: 'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
69:
70: Warning: MessageFormatter::__construct() expects exactly 2 parameters, 1 given in %s on line %d
71: 'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
72:
73: Warning: msgfmt_create() expects exactly 2 parameters, 1 given in %s on line %d
74: 'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
75:
76: Warning: MessageFormatter::create() expects exactly 2 parameters, 1 given in %s on line %d
77: 'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
78: 'msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR'
79: 'msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR'
80: 'msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR'
81: 'msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR'
82: 'msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR'
83: 'msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR'
84:
85: Warning: MessageFormatter::__construct() expects parameter 1 to be string, array given in %s on line %d
86: 'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
87:
88: Warning: MessageFormatter::create() expects parameter 1 to be string, array given in %s on line %d
89: 'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
90:
91: Warning: msgfmt_create() expects parameter 1 to be string, array given in %s on line %d
92: 'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
93: 'msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR'
94: 'msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR'
95: 'msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR'
96: 'msgfmt_create: message formatter creation failed: U_UNMATCHED_BRACES'
97: 'msgfmt_create: message formatter creation failed: U_UNMATCHED_BRACES'
98: 'msgfmt_create: message formatter creation failed: U_UNMATCHED_BRACES'
99: 'msgfmt_create: error converting pattern to UTF-16: U_INVALID_CHAR_FOUND'
100: 'msgfmt_create: error converting pattern to UTF-16: U_INVALID_CHAR_FOUND'
101: 'msgfmt_create: error converting pattern to UTF-16: U_INVALID_CHAR_FOUND'
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>