Annotation of embedaddon/php/ext/mbstring/tests/mb_strrpos_error1.phpt, revision 1.1.1.1

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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>