Annotation of embedaddon/php/ext/iconv/tests/iconv_strrpos_error1.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test iconv_strrpos() function : error conditions - pass incorrect number of args
3: --SKIPIF--
4: <?php
5: extension_loaded('iconv') or die('skip');
6: function_exists('iconv_strrpos') or die("skip iconv_strrpos() is not available in this build");
7: ?>
8: --FILE--
9: <?php
10: /* Prototype : proto int iconv_strrpos(string haystack, string needle [, string charset])
11: * Description: Find position of last occurrence of a string within another
12: * Source code: ext/iconv/iconv.c
13: */
14:
15: /*
16: * Pass iconv_strrpos() an incorrect number of arguments
17: */
18:
19: echo "*** Testing iconv_strrpos() : error conditions ***\n";
20:
21:
22: //Test iconv_strrpos with one more than the expected number of arguments
23: echo "\n-- Testing iconv_strrpos() function with more than expected no. of arguments --\n";
24: $haystack = 'string_val';
25: $needle = 'string_val';
26: $encoding = 'string_val';
27: $extra_arg = 10;
28: var_dump( iconv_strrpos($haystack, $needle, $encoding, $extra_arg) );
29:
30: // Testing iconv_strrpos with one less than the expected number of arguments
31: echo "\n-- Testing iconv_strrpos() function with less than expected no. of arguments --\n";
32: $haystack = 'string_val';
33: var_dump( iconv_strrpos($haystack) );
34:
35: echo "Done";
36: ?>
37: --EXPECTF--
38: *** Testing iconv_strrpos() : error conditions ***
39:
40: -- Testing iconv_strrpos() function with more than expected no. of arguments --
41:
42: Warning: iconv_strrpos() expects at most 3 parameters, 4 given in %s on line %d
43: bool(false)
44:
45: -- Testing iconv_strrpos() function with less than expected no. of arguments --
46:
47: Warning: iconv_strrpos() expects at least 2 parameters, 1 given in %s on line %d
48: bool(false)
49: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>