summaryrefslogtreecommitdiff
path: root/ext/imap/tests/imap_body.phpt
blob: 6c2f6293984ca1750cea05a82e7530038d190a6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
--TEST--
imap_body() ValueError
--CREDITS--
Paul Sohier
#phptestfest utrecht
--SKIPIF--
<?php
require_once(__DIR__.'/skipif.inc');
?>
--FILE--
<?php

require_once(__DIR__.'/imap_include.inc');
$stream_id = imap_open($default_mailbox, $username, $password) or
    die("Cannot connect to mailbox $default_mailbox: " . imap_last_error());

try {
    imap_body($stream_id,-1);
} catch (\ValueError $e) {
    echo $e->getMessage() . \PHP_EOL;
}
try {
    imap_body($stream_id,1,-1);
} catch (\ValueError $e) {
    echo $e->getMessage() . \PHP_EOL;
}

//Access not existing
var_dump(imap_body($stream_id, 255, FT_UID));

imap_close($stream_id);

?>
--EXPECTF--
imap_body(): Argument #2 ($message_num) must be greater than 0
imap_body(): Argument #3 ($flags) must be a bitmask of FT_UID, FT_PEEK, and FT_INTERNAL

Warning: imap_body(): UID does not exist in %s on line %d
bool(false)