Return to array_product_error.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / array |
1.1 misho 1: --TEST-- 2: Test array_product() function : error conditions 3: --FILE-- 4: <?php 5: /* Prototype : mixed array_product(array input) 6: * Description: Returns the product of the array entries 7: * Source code: ext/standard/array.c 8: * Alias to functions: 9: */ 10: 11: echo "*** Testing array_product() : error conditions ***\n"; 12: 13: // Zero arguments 14: echo "\n-- Testing array_product() function with Zero arguments --\n"; 15: var_dump( array_product() ); 16: 17: //Test array_product with one more than the expected number of arguments 18: echo "\n-- Testing array_product() function with more than expected no. of arguments --\n"; 19: $input = array(1, 2); 20: $extra_arg = 10; 21: var_dump( array_product($input, $extra_arg) ); 22: 23: echo "\n-- Testing array_product() function incorrect argument type --\n"; 24: var_dump( array_product("bob") ); 25: 26: ?> 27: ===DONE=== 28: --EXPECTF-- 29: *** Testing array_product() : error conditions *** 30: 31: -- Testing array_product() function with Zero arguments -- 32: 33: Warning: array_product() expects exactly 1 parameter, 0 given in %sarray_product_error.php on line %d 34: NULL 35: 36: -- Testing array_product() function with more than expected no. of arguments -- 37: 38: Warning: array_product() expects exactly 1 parameter, 2 given in %sarray_product_error.php on line %d 39: NULL 40: 41: -- Testing array_product() function incorrect argument type -- 42: 43: Warning: array_product() expects parameter 1 to be array, string given in %sarray_product_error.php on line %d 44: NULL 45: ===DONE===