Return to join_error.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / strings |
1.1 misho 1: --TEST-- 2: Test join() function: error conditions 3: --FILE-- 4: <?php 5: /* Prototype : string join( string $glue, array $pieces ) 6: * Description: Join array elements with a string 7: * Source code: ext/standard/string.c 8: * Alias of function: implode() 9: */ 10: 11: echo "*** Testing join() : error conditions ***\n"; 12: 13: // Zero argument 14: echo "\n-- Testing join() function with Zero arguments --\n"; 15: var_dump( join() ); 16: 17: // More than expected number of arguments 18: echo "\n-- Testing join() function with more than expected no. of arguments --\n"; 19: $glue = 'string_val'; 20: $pieces = array(1, 2); 21: $extra_arg = 10; 22: 23: var_dump( join($glue, $pieces, $extra_arg) ); 24: 25: // Less than expected number of arguments 26: echo "\n-- Testing join() with less than expected no. of arguments --\n"; 27: $glue = 'string_val'; 28: 29: var_dump( join($glue)); 30: 31: echo "Done\n"; 32: ?> 33: --EXPECTF-- 34: *** Testing join() : error conditions *** 35: 36: -- Testing join() function with Zero arguments -- 37: 38: Warning: join() expects at least 1 parameter, 0 given in %s on line %d 39: NULL 40: 41: -- Testing join() function with more than expected no. of arguments -- 42: 43: Warning: join() expects at most 2 parameters, 3 given in %s on line %d 44: NULL 45: 46: -- Testing join() with less than expected no. of arguments -- 47: 48: Warning: join(): Argument must be an array in %s on line %d 49: NULL 50: Done