Annotation of embedaddon/php/ext/standard/tests/strings/strpbrk_error.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test strpbrk() function : error conditions 
                      3: --FILE--
                      4: <?php
                      5: /* Prototype  : array strpbrk(string haystack, string char_list)
                      6:  * Description: Search a string for any of a set of characters 
                      7:  * Source code: ext/standard/string.c
                      8:  * Alias to functions: 
                      9:  */
                     10: 
                     11: echo "*** Testing strpbrk() : error conditions ***\n";
                     12: 
                     13: $haystack = 'This is a Simple text.';
                     14: $char_list = 'string_val';
                     15: $extra_arg = 10;
                     16: 
                     17: echo "\n-- Testing strpbrk() function with more than expected no. of arguments --\n";
                     18: var_dump( strpbrk($haystack, $char_list, $extra_arg) );
                     19: 
                     20: echo "\n-- Testing strpbrk() function with less than expected no. of arguments --\n";
                     21: var_dump( strpbrk($haystack) );
                     22: 
                     23: echo "\n-- Testing strpbrk() function with empty second argument --\n";
                     24: var_dump( strpbrk($haystack, '') );
                     25: 
                     26: echo "\n-- Testing strpbrk() function with arrays --\n";
                     27: var_dump( strpbrk($haystack, array('a', 'b', 'c') ) );
                     28: var_dump( strpbrk(array('foo', 'bar'), 'b') );
                     29: 
                     30: ?>
                     31: ===DONE===
                     32: --EXPECTF--
                     33: *** Testing strpbrk() : error conditions ***
                     34: 
                     35: -- Testing strpbrk() function with more than expected no. of arguments --
                     36: 
                     37: Warning: strpbrk() expects exactly 2 parameters, 3 given in %s on line %d
                     38: bool(false)
                     39: 
                     40: -- Testing strpbrk() function with less than expected no. of arguments --
                     41: 
                     42: Warning: strpbrk() expects exactly 2 parameters, 1 given in %s on line %d
                     43: bool(false)
                     44: 
                     45: -- Testing strpbrk() function with empty second argument --
                     46: 
                     47: Warning: strpbrk(): The character list cannot be empty in %s on line %d
                     48: bool(false)
                     49: 
                     50: -- Testing strpbrk() function with arrays --
                     51: 
                     52: Warning: strpbrk() expects parameter 2 to be string, array given in %s on line %d
                     53: bool(false)
                     54: 
                     55: Warning: strpbrk() expects parameter 1 to be string, array given in %s on line %d
                     56: bool(false)
                     57: ===DONE===

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