1--TEST--
2imap_headerinfo() 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	'Recent','Unseen','Flagged','Answered','Deleted','Draft',
22	'Msgno','MailDate','Size','udate');
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: ".$z->Recent;
41}
42echo "\n";
43
44if ($z->Unseen == 'U' || $z->Unseen == ' ') {
45	echo "Unseen: OK";
46} else {
47	echo "Unseen: error: ".$z->Unseen;
48}
49echo "\n";
50
51if ($z->Flagged == 'F' || $z->Flagged == ' ') {
52	echo "Flagged: OK";
53} else {
54	echo "Flagged: error: ".$z->Flagged;
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)
107bool(true)
108bool(true)
109bool(true)
110bool(true)
111bool(true)
112bool(true)
113bool(true)
114Check type
115string(%d) "%s"
116string(%d) "%s"
117string(%d) "%s"
118string(%d) "%s"
119string(%d) "%s"
120string(%d) "%s"
121Recent: OK
122Unseen: OK
123Flagged: OK
124Answered: OK
125Deleted: OK
126Draft: OK
127string(%d) "%s"
128string(%d) "%d"
129int(%d)