Annotation of embedaddon/php/ext/mbstring/tests/mb_stripos_error1.phpt, revision 1.1.1.1

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

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