1--TEST--
2imap_rfc822_parse_headers() function : basic functionality
3--CREDITS--
4Olivier Doucet
5--SKIPIF--
6<?php
7require_once(dirname(__FILE__).'/skipif.inc');
8?>
9--FILE--
10<?php
11
12require_once(dirname(__FILE__).'/imap_include.inc');
13$stream_id = setup_test_mailbox('', 1);
14
15$z = imap_headerinfo($stream_id, 1);
16
17$fields = array ('toaddress','to','fromaddress','from',
18'reply_toaddress','reply_to',
19	'senderaddress', 'sender',
20'subject','Subject',
21	'MailDate','Size','udate');
22
23
24echo "Check general fields\n";
25foreach ($fields as $key) {
26	var_dump(isset($z->$key));
27}
28
29echo "Check type\n";
30var_dump($z->toaddress);
31var_dump($z->fromaddress);
32var_dump($z->reply_toaddress);
33var_dump($z->senderaddress);
34var_dump($z->subject);
35var_dump($z->Subject);
36
37if ($z->Recent == 'R' || $z->Recent == 'N' || $z->Recent == ' ') {
38	echo "Recent: OK";
39} else {
40	echo "Recent: error";
41}
42echo "\n";
43
44if ($z->Unseen == 'U' || $z->Unseen == ' ') {
45	echo "Unseen: OK";
46} else {
47	echo "Unseen: error";
48}
49echo "\n";
50
51if ($z->Flagged == 'F' || $z->Flagged == ' ') {
52	echo "Flagged: OK";
53} else {
54	echo "Flagged: error";
55}
56echo "\n";
57
58if ($z->Answered == 'A' || $z->Answered == ' ') {
59	echo "Answered: OK";
60} else {
61	echo "Answered: error";
62}
63echo "\n";
64
65if ($z->Deleted == 'D' || $z->Deleted == ' ') {
66	echo "Deleted: OK";
67} else {
68	echo "Deleted: error";
69}
70echo "\n";
71
72if ($z->Draft == 'X' || $z->Draft == ' ') {
73	echo "Draft: OK";
74} else {
75	echo "Draft: error";
76}
77echo "\n";
78
79var_dump($z->Msgno);
80var_dump($z->Size);
81var_dump($z->udate);
82
83imap_close($stream_id);
84
85?>
86--CLEAN--
87<?php
88require_once('clean.inc');
89?>
90--EXPECTF--
91Create a temporary mailbox and add 1 msgs
92.. mailbox '{%s}%s' created
93Check general fields
94bool(true)
95bool(true)
96bool(true)
97bool(true)
98bool(true)
99bool(true)
100bool(true)
101bool(true)
102bool(true)
103bool(true)
104bool(true)
105bool(true)
106bool(true)
107Check type
108string(%d) "%s"
109string(%d) "%s"
110string(%d) "%s"
111string(%d) "%s"
112string(%d) "%s"
113string(%d) "%s"
114Recent: OK
115Unseen: OK
116Flagged: OK
117Answered: OK
118Deleted: OK
119Draft: OK
120string(%d) "%s"
121string(%d) "%d"
122int(%d)