1
1
--TEST--
2
- imap_body() incorrect parameter count
2
+ imap_body() ValueError
3
3
--CREDITS--
4
4
Paul Sohier
5
5
#phptestfest utrecht
@@ -14,19 +14,26 @@ require_once(__DIR__.'/imap_include.inc');
14
14
$ stream_id = imap_open ($ default_mailbox , $ username , $ password ) or
15
15
die ("Cannot connect to mailbox $ default_mailbox: " . imap_last_error ());
16
16
17
- imap_body ($ stream_id ,-1 );
18
- imap_body ($ stream_id ,1 ,-1 );
17
+ try {
18
+ imap_body ($ stream_id ,-1 );
19
+ } catch (\ValueError $ e ) {
20
+ echo $ e ->getMessage () . \PHP_EOL ;
21
+ }
22
+ try {
23
+ imap_body ($ stream_id ,1 ,-1 );
24
+ } catch (\ValueError $ e ) {
25
+ echo $ e ->getMessage () . \PHP_EOL ;
26
+ }
19
27
20
28
//Access not existing
21
- var_dump (imap_body ($ stream_id , 999 , FT_UID ));
29
+ var_dump (imap_body ($ stream_id , 255 , FT_UID ));
22
30
23
31
imap_close ($ stream_id );
24
32
25
33
?>
26
34
--EXPECTF--
27
- Warning: imap_body(): Bad message number in %s on line %d
35
+ imap_body(): Argument #2 ($msg_no) must be greater than 0
36
+ imap_body(): Argument #3 ($options) must be a bitmask of FT_UID, FT_PEEK, and FT_INTERNAL
28
37
29
- Warning: imap_body(): Invalid value for the options parameter in %s on line %d
30
-
31
- Warning: imap_body(): Bad message number in %s on line %d
38
+ Warning: imap_body(): UID does not exist in %s on line %d
32
39
bool(false)
0 commit comments