Return to nl2br_error.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / strings |
1.1 misho 1: --TEST-- 2: Test nl2br() function : error conditions 3: --FILE-- 4: <?php 5: /* Prototype : string nl2br(string $str) 6: * Description: Inserts HTML line breaks before all newlines in a string. 7: * Source code: ext/standard/string.c 8: */ 9: 10: echo "*** Testing nl2br() : error conditions ***\n"; 11: 12: // Zero arguments 13: echo "\n-- Testing nl2br() function with Zero arguments --"; 14: var_dump( nl2br() ); 15: 16: //Test nl2br with one more than the expected number of arguments 17: echo "\n-- Testing nl2br() function with more than expected no. of arguments --"; 18: $str = 'string_val'; 19: $extra_arg = 10; 20: var_dump( nl2br($str, true, $extra_arg) ); 21: 22: echo "Done"; 23: ?> 24: --EXPECTF-- 25: *** Testing nl2br() : error conditions *** 26: 27: -- Testing nl2br() function with Zero arguments -- 28: Warning: nl2br() expects at least 1 parameter, 0 given in %s on line %d 29: NULL 30: 31: -- Testing nl2br() function with more than expected no. of arguments -- 32: Warning: nl2br() expects at most 2 parameters, 3 given in %s on line %d 33: NULL 34: Done