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($z->ifparameters);
38var_dump(is_object($z->parameters[0]));
39
40imap_close($stream_id);
41?>
42--CLEAN--
43<?php
44require_once('clean.inc');
45?>
46--EXPECTF--
47Checking with no parameters
48
49Warning: imap_fetchstructure() expects at least 2 parameters, 0 given in %s on line %d
50Checking with incorrect parameter type
51
52Warning: imap_fetchstructure() expects at least 2 parameters, 1 given in %s on line %d
53
54Warning: imap_fetchstructure() expects at least 2 parameters, 1 given in %s on line %d
55Create a temporary mailbox and add 1 msgs
56.. mailbox '{%s}%s' created
57
58Warning: imap_fetchstructure() expects at least 2 parameters, 1 given in %s on line %d
59bool(true)
60bool(true)
61bool(true)
62bool(true)
63bool(true)
64bool(true)
65bool(true)
66bool(true)
67int(%d)
68int(%d)
69int(%d)
70int(%d)
71int(1)
72bool(true)
73