Annotation of embedaddon/php/ext/standard/tests/mail/ezmlm_hash_error.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test 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:
10: echo "*** Testing ezmlm_hash() : error conditions ***\n";
11:
12: echo "\n-- Testing ezmlm_hash() function with fewer than expected no. of arguments --\n";
13: var_dump( ezmlm_hash() );
14:
15: echo "\n-- Testing ezmlm_hash() function with more than expected no. of arguments --\n";
16: $extra_arg = 10;
17: var_dump( ezmlm_hash("webmaster@example.com", $extra_arg) );
18:
19: echo "\n-- Testing ezmlm_hash() function with invalid input - ARRAY --\n";
20: $array_arg = array(1,2,3,4);
21: $extra_arg = 10;
22: var_dump( ezmlm_hash($array_arg) );
23:
24: echo "\n-- Testing ezmlm_hash() function with invalid input - OBJECT without 'cast_object' method --\n";
25: class sample {
26: }
27:
28: $obj_arg = new sample();
29: var_dump( ezmlm_hash($obj_arg) );
30:
31: echo "\n-- Testing ezmlm_hash() function with invalid input - RESOURCE --\n";
32: $file_handle = fopen(__FILE__, "r");
33: $extra_arg = 10;
34: var_dump( ezmlm_hash($file_handle) );
35: fclose($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:
44: Warning: ezmlm_hash() expects exactly 1 parameter, 0 given in %s on line %d
45: NULL
46:
47: -- Testing ezmlm_hash() function with more than expected no. of arguments --
48:
49: Warning: ezmlm_hash() expects exactly 1 parameter, 2 given in %s on line %d
50: NULL
51:
52: -- Testing ezmlm_hash() function with invalid input - ARRAY --
53:
54: Warning: ezmlm_hash() expects parameter 1 to be string, array given in %s on line %d
55: NULL
56:
57: -- Testing ezmlm_hash() function with invalid input - OBJECT without 'cast_object' method --
58:
59: Warning: ezmlm_hash() expects parameter 1 to be string, object given in %s on line %d
60: NULL
61:
62: -- Testing ezmlm_hash() function with invalid input - RESOURCE --
63:
64: Warning: ezmlm_hash() expects parameter 1 to be string, resource given in %s on line %d
65: NULL
66: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>