Return to rsort_error.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / array |
1.1 misho 1: --TEST-- 2: Test rsort() function : error conditions - Pass incorrect number of args 3: --FILE-- 4: <?php 5: /* Prototype : bool rsort(array &$array_arg [, int $sort_flags]) 6: * Description: Sort an array in reverse order 7: * Source code: ext/standard/array.c 8: */ 9: 10: /* 11: * Pass incorrect number of arguments to rsort() to test behaviour 12: */ 13: 14: echo "*** Testing rsort() : error conditions ***\n"; 15: 16: // zero arguments 17: echo "\n-- Testing rsort() function with Zero arguments --\n"; 18: var_dump( rsort() ); 19: 20: //Test rsort() with more than the expected number of arguments 21: echo "\n-- Testing rsort() function with more than expected no. of arguments --\n"; 22: $array_arg = array(1, 2); 23: $sort_flags = SORT_REGULAR; 24: $extra_arg = 10; 25: var_dump( rsort($array_arg, $sort_flags, $extra_arg) ); 26: 27: // dump the input array to ensure that it wasn't changed 28: var_dump($array_arg); 29: 30: echo "Done"; 31: ?> 32: 33: --EXPECTF-- 34: *** Testing rsort() : error conditions *** 35: 36: -- Testing rsort() function with Zero arguments -- 37: 38: Warning: rsort() expects at least 1 parameter, 0 given in %s on line %d 39: bool(false) 40: 41: -- Testing rsort() function with more than expected no. of arguments -- 42: 43: Warning: rsort() expects at most 2 parameters, 3 given in %s on line %d 44: bool(false) 45: array(2) { 46: [0]=> 47: int(1) 48: [1]=> 49: int(2) 50: } 51: Done