Annotation of embedaddon/php/ext/standard/tests/strings/stristr_error.phpt, revision 1.1.1.2

1.1       misho       1: --TEST--
                      2: Test stristr() function : error conditions 
                      3: --FILE--
                      4: <?php
                      5: 
                      6: /* Prototype: string stristr  ( string $haystack  , mixed $needle  [, bool $before_needle  ] )
                      7:    Description: Case-insensitive strstr()
                      8: */
                      9: echo "*** Testing stristr() : error conditions ***\n";
                     10: 
                     11: echo "\n-- Testing stristr() function with no arguments --\n";
                     12: var_dump( stristr() );
                     13: var_dump( stristr("") );
                     14: 
                     15: echo "\n-- Testing stristr() function with no needle --\n";
                     16: var_dump( stristr("Hello World") );  // without "needle"
                     17: 
                     18: echo "\n-- Testing stristr() function with more than expected no. of arguments --\n";
                     19: $extra_arg = 10;
                     20: var_dump( stristr("Hello World",  "World", true, $extra_arg) );
                     21: 
                     22: echo "\n-- Testing stristr() function with empty haystack --\n";
                     23: var_dump( stristr(NULL, "") );
                     24: 
                     25: echo "\n-- Testing stristr() function with empty needle --\n";
                     26: var_dump( stristr("Hello World", "") );
                     27: 
                     28: ?>
                     29: ===DONE===
                     30: --EXPECTF--
                     31: *** Testing stristr() : error conditions ***
                     32: 
                     33: -- Testing stristr() function with no arguments --
                     34: 
                     35: Warning: stristr() expects at least 2 parameters, 0 given in %s on line %d
                     36: NULL
                     37: 
                     38: Warning: stristr() expects at least 2 parameters, 1 given in %s on line %d
                     39: NULL
                     40: 
                     41: -- Testing stristr() function with no needle --
                     42: 
                     43: Warning: stristr() expects at least 2 parameters, 1 given in %s on line %d
                     44: NULL
                     45: 
                     46: -- Testing stristr() function with more than expected no. of arguments --
                     47: 
                     48: Warning: stristr() expects at most 3 parameters, 4 given in %s on line %d
                     49: NULL
                     50: 
                     51: -- Testing stristr() function with empty haystack --
                     52: 
1.1.1.2 ! misho      53: Warning: stristr(): Empty needle in %s on line %d
1.1       misho      54: bool(false)
                     55: 
                     56: -- Testing stristr() function with empty needle --
                     57: 
1.1.1.2 ! misho      58: Warning: stristr(): Empty needle in %s on line %d
1.1       misho      59: bool(false)
                     60: ===DONE===

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