1--TEST-- 2Test ezmlm_hash() function : error conditions 3--FILE-- 4<?php 5/* Prototype : int ezmlm_hash ( string $addr ) 6 * Description: Calculate the hash value needed by EZMLM. 7 * Source code: ext/standard/mail.c 8 */ 9 10echo "*** Testing ezmlm_hash() : error conditions ***\n"; 11 12echo "\n-- Testing ezmlm_hash() function with fewer than expected no. of arguments --\n"; 13var_dump( ezmlm_hash() ); 14 15echo "\n-- Testing ezmlm_hash() function with more than expected no. of arguments --\n"; 16$extra_arg = 10; 17var_dump( ezmlm_hash("webmaster@example.com", $extra_arg) ); 18 19echo "\n-- Testing ezmlm_hash() function with invalid input - ARRAY --\n"; 20$array_arg = array(1,2,3,4); 21$extra_arg = 10; 22var_dump( ezmlm_hash($array_arg) ); 23 24echo "\n-- Testing ezmlm_hash() function with invalid input - OBJECT without 'cast_object' method --\n"; 25class sample { 26} 27 28$obj_arg = new sample(); 29var_dump( ezmlm_hash($obj_arg) ); 30 31echo "\n-- Testing ezmlm_hash() function with invalid input - RESOURCE --\n"; 32$file_handle = fopen(__FILE__, "r"); 33$extra_arg = 10; 34var_dump( ezmlm_hash($file_handle) ); 35fclose($file_handle); 36 37?> 38===DONE=== 39--EXPECTF-- 40*** Testing ezmlm_hash() : error conditions *** 41 42-- Testing ezmlm_hash() function with fewer than expected no. of arguments -- 43 44Warning: ezmlm_hash() expects exactly 1 parameter, 0 given in %s on line %d 45NULL 46 47-- Testing ezmlm_hash() function with more than expected no. of arguments -- 48 49Warning: ezmlm_hash() expects exactly 1 parameter, 2 given in %s on line %d 50NULL 51 52-- Testing ezmlm_hash() function with invalid input - ARRAY -- 53 54Warning: ezmlm_hash() expects parameter 1 to be string, array given in %s on line %d 55NULL 56 57-- Testing ezmlm_hash() function with invalid input - OBJECT without 'cast_object' method -- 58 59Warning: ezmlm_hash() expects parameter 1 to be string, object given in %s on line %d 60NULL 61 62-- Testing ezmlm_hash() function with invalid input - RESOURCE -- 63 64Warning: ezmlm_hash() expects parameter 1 to be string, resource given in %s on line %d 65NULL 66===DONE=== 67