Annotation of embedaddon/php/ext/pcre/tests/preg_grep_error.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test preg_grep() function : error conditions - wrong numbers of parameters
                      3: --FILE--
                      4: <?php
                      5: /*
                      6: * proto array preg_grep(string regex, array input [, int flags])
                      7: * Function is implemented in ext/pcre/php_pcre.c
                      8: */
                      9: echo "*** Testing preg_grep() : error conditions ***\n";
                     10: // Zero arguments
                     11: echo "\n-- Testing preg_grep() function with Zero arguments --\n";
                     12: var_dump(preg_grep());
                     13: //Test preg_grep with one more than the expected number of arguments
                     14: echo "\n-- Testing preg_grep() function with more than expected no. of arguments --\n";
                     15: $regex = '/\d/';
                     16: $input = array(1, 2);
                     17: $flags = 0;
                     18: $extra_arg = 10;
                     19: var_dump(preg_grep($regex, $input, $flags, $extra_arg));
                     20: // Testing preg_grep withone less than the expected number of arguments
                     21: echo "\n-- Testing preg_grep() function with less than expected no. of arguments --\n";
                     22: $regex = 'string_val';
                     23: var_dump(preg_grep($regex));
                     24: echo "Done"
                     25: ?>
                     26: --EXPECTF--
                     27: *** Testing preg_grep() : error conditions ***
                     28: 
                     29: -- Testing preg_grep() function with Zero arguments --
                     30: 
                     31: Warning: preg_grep() expects at least 2 parameters, 0 given in %spreg_grep_error.php on line %d
                     32: NULL
                     33: 
                     34: -- Testing preg_grep() function with more than expected no. of arguments --
                     35: 
                     36: Warning: preg_grep() expects at most 3 parameters, 4 given in %spreg_grep_error.php on line %d
                     37: NULL
                     38: 
                     39: -- Testing preg_grep() function with less than expected no. of arguments --
                     40: 
                     41: Warning: preg_grep() expects at least 2 parameters, 1 given in %spreg_grep_error.php on line %d
                     42: NULL
                     43: Done

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