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

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

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