Annotation of embedaddon/php/ext/mbstring/tests/mb_ereg_match_error1.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test mb_ereg_match() function : error conditions - pass function incorrect number of arguments
! 3: --SKIPIF--
! 4: <?php
! 5: extension_loaded('mbstring') or die('skip');
! 6: function_exists('mb_ereg_match') or die("skip mb_ereg_match() is not available in this build");
! 7: ?>
! 8: --FILE--
! 9: <?php
! 10: /* Prototype : bool mb_ereg_match(string $pattern, string $string [,string $option])
! 11: * Description: Regular expression match for multibyte string
! 12: * Source code: ext/mbstring/php_mbregex.c
! 13: */
! 14:
! 15: /*
! 16: * Test mb_ereg_match by passing an incorrect number of arguments
! 17: */
! 18:
! 19: echo "*** Testing mb_ereg_match() : error conditions ***\n";
! 20:
! 21:
! 22: //Test mb_ereg_match with one more than the expected number of arguments
! 23: echo "\n-- Testing mb_ereg_match() function with more than expected no. of arguments --\n";
! 24: $pattern = b'string_val';
! 25: $string = b'string_val';
! 26: $option = 'string_val';
! 27: $extra_arg = 10;
! 28: var_dump( mb_ereg_match($pattern, $string, $option, $extra_arg) );
! 29:
! 30: // Testing mb_ereg_match with one less than the expected number of arguments
! 31: echo "\n-- Testing mb_ereg_match() function with less than expected no. of arguments --\n";
! 32: $pattern = b'string_val';
! 33: var_dump( mb_ereg_match($pattern) );
! 34:
! 35: // Testing mb_ereg_match with zero arguments
! 36: echo "\n-- Testing mb_ereg_match() function with zero arguments --\n";
! 37: var_dump( mb_ereg_match() );
! 38:
! 39: echo "Done";
! 40: ?>
! 41: --EXPECTF--
! 42: *** Testing mb_ereg_match() : error conditions ***
! 43:
! 44: -- Testing mb_ereg_match() function with more than expected no. of arguments --
! 45:
! 46: Warning: mb_ereg_match() expects at most 3 parameters, 4 given in %s on line %d
! 47: bool(false)
! 48:
! 49: -- Testing mb_ereg_match() function with less than expected no. of arguments --
! 50:
! 51: Warning: mb_ereg_match() expects at least 2 parameters, 1 given in %s on line %d
! 52: bool(false)
! 53:
! 54: -- Testing mb_ereg_match() function with zero arguments --
! 55:
! 56: Warning: mb_ereg_match() expects at least 2 parameters, 0 given in %s on line %d
! 57: bool(false)
! 58: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>