1--TEST--
2imap_savebody() function : basic functionality
3--CREDITS--
4Olivier Doucet
5--SKIPIF--
6<?php
7require_once(__DIR__.'/skipif.inc');
8?>
9--FILE--
10<?php
11echo "Checking with no parameters\n";
12imap_savebody();
13
14echo  "Checking with incorrect parameter type\n";
15imap_savebody('');
16imap_savebody(false);
17
18require_once(__DIR__.'/imap_include.inc');
19$stream_id = setup_test_mailbox('', 1);
20
21imap_savebody($stream_id);
22
23$file = __DIR__.'/tmpsavebody.txt';
24
25//with URL
26$z = imap_savebody($stream_id, $file, 1);
27var_dump($z);
28echo "Size: ".filesize($file)."\n";
29
30//With FOPEN
31$fp = fopen($file, 'w');
32$z = imap_savebody($stream_id, $fp, 1);
33fclose($fp);
34var_dump($z);
35echo "Size: ".filesize($file)."\n";
36
37imap_close($stream_id);
38?>
39--CLEAN--
40<?php
41@unlink(__DIR__.'/tmpsavebody.txt');
42require_once('clean.inc');
43?>
44--EXPECTF--
45Checking with no parameters
46
47Warning: imap_savebody() expects at least 3 parameters, 0 given in %s on line %d
48Checking with incorrect parameter type
49
50Warning: imap_savebody() expects at least 3 parameters, 1 given in %s on line %d
51
52Warning: imap_savebody() expects at least 3 parameters, 1 given in %s on line %d
53Create a temporary mailbox and add 1 msgs
54.. mailbox '{%s}%s' created
55
56Warning: imap_savebody() expects at least 3 parameters, 1 given in %s on line %d
57bool(true)
58Size: %d
59bool(true)
60Size: %d
61