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