Annotation of embedaddon/php/ext/standard/tests/strings/strtr_error.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test strtr() function : error conditions
3: --FILE--
4: <?php
5: /* Prototype : string strtr(string str, string from[, string to])
6: * Description: Translates characters in str using given translation tables
7: * Source code: ext/standard/string.c
8: */
9:
10: echo "*** Testing strtr() : error conditions ***\n";
11: $str = "string";
12: $from = "string";
13: $to = "STRING";
14: $extra_arg = "extra_argument";
15:
16: echo "\n-- Testing strtr() function with Zero arguments --";
17: var_dump( strtr() );
18:
19: echo "\n-- Testing strtr() function with less than expected no. of arguments --";
20: var_dump( strtr($str) );
21:
22: echo "\n-- Testing strtr() function with more than expected no. of arguments --";
23: var_dump( strtr($str, $from, $to, $extra_arg) );
24:
25: echo "Done";
26: ?>
27: --EXPECTF--
28: *** Testing strtr() : error conditions ***
29:
30: -- Testing strtr() function with Zero arguments --
31: Warning: strtr() expects at least 2 parameters, 0 given in %s on line %d
32: NULL
33:
34: -- Testing strtr() function with less than expected no. of arguments --
35: Warning: strtr() expects at least 2 parameters, 1 given in %s on line %d
36: NULL
37:
38: -- Testing strtr() function with more than expected no. of arguments --
39: Warning: strtr() expects at most 3 parameters, 4 given in %s on line %d
40: NULL
41: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>