diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2013-03-14 05:42:27 +0000 |
---|---|---|
committer | <> | 2013-04-03 16:25:08 +0000 |
commit | c4dd7a1a684490673e25aaf4fabec5df138854c4 (patch) | |
tree | 4d57c44caae4480efff02b90b9be86f44bf25409 /ext/pcre/tests/preg_match_all_error.phpt | |
download | php2-master.tar.gz |
Imported from /home/lorry/working-area/delta_php2/php-5.4.13.tar.bz2.HEADphp-5.4.13master
Diffstat (limited to 'ext/pcre/tests/preg_match_all_error.phpt')
-rw-r--r-- | ext/pcre/tests/preg_match_all_error.phpt | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/ext/pcre/tests/preg_match_all_error.phpt b/ext/pcre/tests/preg_match_all_error.phpt new file mode 100644 index 0000000..f6e8928 --- /dev/null +++ b/ext/pcre/tests/preg_match_all_error.phpt @@ -0,0 +1,44 @@ +--TEST-- +Test preg_match_all() function : error conditions - incorrect number of parameters +--FILE-- +<?php +/* +* proto int preg_match_all(string pattern, string subject, array subpatterns [, int flags [, int offset]]) +* Function is implemented in ext/pcre/php_pcre.c +*/ +echo "*** Testing preg_match_all() : error conditions ***\n"; +// Zero arguments +echo "\n-- Testing preg_match_all() function with Zero arguments --\n"; +var_dump(preg_match_all()); +//Test preg_match_all with one more than the expected number of arguments +echo "\n-- Testing preg_match_all() function with more than expected no. of arguments --\n"; +$pattern = '/\w/'; +$subject = 'string_val'; +$flags = PREG_OFFSET_CAPTURE; +$offset = 10; +$extra_arg = 10; +var_dump(preg_match_all($pattern, $subject, $matches, $flags, $offset, $extra_arg)); +// Testing preg_match_all withone less than the expected number of arguments +echo "\n-- Testing preg_match_all() function with less than expected no. of arguments --\n"; +$pattern = '/\w/'; +var_dump(preg_match_all($pattern)); +echo "Done" +?> +--EXPECTF-- +*** Testing preg_match_all() : error conditions *** + +-- Testing preg_match_all() function with Zero arguments -- + +Warning: preg_match_all() expects at least 2 parameters, 0 given in %spreg_match_all_error.php on line %d +bool(false) + +-- Testing preg_match_all() function with more than expected no. of arguments -- + +Warning: preg_match_all() expects at most 5 parameters, 6 given in %spreg_match_all_error.php on line %d +bool(false) + +-- Testing preg_match_all() function with less than expected no. of arguments -- + +Warning: preg_match_all() expects at least 2 parameters, 1 given in %spreg_match_all_error.php on line %d +bool(false) +Done |