Annotation of embedaddon/php/ext/iconv/tests/iconv_substr_error1.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test iconv_substr() function : error conditions - Pass incorrect number of args
                      3: --SKIPIF--
                      4: <?php
                      5: extension_loaded('iconv') or die('skip');
                      6: function_exists('iconv_substr') or die("skip iconv_substr() is not available in this build");
                      7: ?>
                      8: --FILE--
                      9: <?php
                     10: /* Prototype  : string iconv_substr(string str, int offset, [int length, string charset])
                     11:  * Description: Returns part of a string 
                     12:  * Source code: ext/iconv/iconv.c
                     13:  */
                     14: 
                     15: /*
                     16:  * Pass incorrect number of arguments to iconv_substr() to test behaviour
                     17:  */
                     18: 
                     19: echo "*** Testing iconv_substr() : error conditions ***\n";
                     20: 
                     21: //Test iconv_substr with one more than the expected number of arguments
                     22: echo "\n-- Testing iconv_substr() function with more than expected no. of arguments --\n";
                     23: $str = 'string_val';
                     24: $start = 10;
                     25: $length = 10;
                     26: $encoding = 'string_val';
                     27: $extra_arg = 10;
                     28: var_dump( iconv_substr($str, $start, $length, $encoding, $extra_arg) );
                     29: 
                     30: // Testing iconv_substr with one less than the expected number of arguments
                     31: echo "\n-- Testing iconv_substr() function with less than expected no. of arguments --\n";
                     32: $str = 'string_val';
                     33: var_dump( iconv_substr($str) );
                     34: 
                     35: echo "Done";
                     36: ?>
                     37: --EXPECTF--
                     38: *** Testing iconv_substr() : error conditions ***
                     39: 
                     40: -- Testing iconv_substr() function with more than expected no. of arguments --
                     41: 
                     42: Warning: iconv_substr() expects at most 4 parameters, 5 given in %s on line %d
                     43: bool(false)
                     44: 
                     45: -- Testing iconv_substr() function with less than expected no. of arguments --
                     46: 
                     47: Warning: iconv_substr() expects at least 2 parameters, 1 given in %s on line %d
                     48: bool(false)
                     49: Done
                     50: 

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