1--TEST--
2imap_fetchstructure() function : basic functionality
3--CREDITS--
4Olivier Doucet
5--EXTENSIONS--
6imap
7--SKIPIF--
8<?php
9require_once(__DIR__.'/setup/skipif.inc');
10?>
11--FILE--
12<?php
13
14require_once(__DIR__.'/setup/imap_include.inc');
15$stream_id = setup_test_mailbox('imapfetchstructurebasic', 1);
16
17try {
18    imap_fetchstructure($stream_id,0);
19} catch (\ValueError $e) {
20    echo $e->getMessage() . \PHP_EOL;
21}
22
23$z = imap_fetchstructure($stream_id,1);
24
25
26$fields = array('type','encoding','ifsubtype','subtype',
27'ifdescription','lines','bytes','parameters');
28
29foreach ($fields as $key) {
30    var_dump(isset($z->$key));
31}
32var_dump($z->type);
33var_dump($z->encoding);
34var_dump($z->bytes);
35var_dump($z->lines);
36var_dump($z->ifparameters);
37var_dump(is_object($z->parameters[0]));
38
39imap_close($stream_id);
40?>
41--CLEAN--
42<?php
43$mailbox_suffix = 'imapfetchstructurebasic';
44require_once('setup/clean.inc');
45?>
46--EXPECTF--
47Create a temporary mailbox and add 1 msgs
48New mailbox created
49imap_fetchstructure(): Argument #2 ($message_num) must be greater than 0
50bool(true)
51bool(true)
52bool(true)
53bool(true)
54bool(true)
55bool(true)
56bool(true)
57bool(true)
58int(%d)
59int(%d)
60int(%d)
61int(%d)
62int(1)
63bool(true)
64