1--TEST--
2imap_fetchstructure() function : basic functionality
3--CREDITS--
4Olivier Doucet
5--SKIPIF--
6<?php
7require_once(dirname(__FILE__).'/skipif.inc');
8?>
9--FILE--
10<?php
11echo "Checking with no parameters\n";
12imap_fetchstructure();
13
14echo  "Checking with incorrect parameter type\n";
15imap_fetchstructure('');
16imap_fetchstructure(false);
17
18require_once(dirname(__FILE__).'/imap_include.inc');
19$stream_id = setup_test_mailbox('', 1);
20
21imap_fetchstructure($stream_id);
22imap_fetchstructure($stream_id,0);
23
24$z = imap_fetchstructure($stream_id,1);
25
26
27$fields = array('type','encoding','ifsubtype','subtype',
28'ifdescription','lines','bytes','parameters');
29
30foreach ($fields as $key) {
31	var_dump(isset($z->$key));
32}
33var_dump($z->type);
34var_dump($z->encoding);
35var_dump($z->bytes);
36var_dump($z->lines);
37var_dump(is_object($z->parameters));
38
39imap_close($stream_id);
40?>
41--CLEAN--
42<?php
43require_once('clean.inc');
44?>
45--EXPECTF--
46Checking with no parameters
47
48Warning: imap_fetchstructure() expects at least 2 parameters, 0 given in %s on line %d
49Checking with incorrect parameter type
50
51Warning: imap_fetchstructure() expects at least 2 parameters, 1 given in %s on line %d
52
53Warning: imap_fetchstructure() expects at least 2 parameters, 1 given in %s on line %d
54Create a temporary mailbox and add 1 msgs
55.. mailbox '{%s}%s' created
56
57Warning: imap_fetchstructure() expects at least 2 parameters, 1 given in %s on line %d
58bool(true)
59bool(true)
60bool(true)
61bool(true)
62bool(true)
63bool(true)
64bool(true)
65bool(true)
66int(%d)
67int(%d)
68int(%d)
69int(%d)
70bool(true)