1--TEST-- 2imap_headerinfo() function : basic functionality 3--CREDITS-- 4Olivier Doucet 5--SKIPIF-- 6<?php 7require_once(__DIR__.'/setup/skipif.inc'); 8?> 9--FILE-- 10<?php 11 12require_once(__DIR__.'/setup/imap_include.inc'); 13$stream_id = setup_test_mailbox('imapheaderinfobasic', 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 88$mailbox_suffix = 'imapheaderinfobasic'; 89require_once('setup/clean.inc'); 90?> 91--EXPECTF-- 92Create a temporary mailbox and add 1 msgs 93New mailbox created 94Check general fields 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) 114bool(true) 115Check type 116string(%d) "%s" 117string(%d) "%s" 118string(%d) "%s" 119string(%d) "%s" 120string(%d) "%s" 121string(%d) "%s" 122Recent: OK 123Unseen: OK 124Flagged: OK 125Answered: OK 126Deleted: OK 127Draft: OK 128string(%d) "%s" 129string(%d) "%d" 130int(%d) 131