Annotation of embedaddon/php/ext/pcre/tests/preg_replace_error.phpt, revision 1.1

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

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