1--TEST-- 2imap_headerinfo() 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('imapheaderinfobasic', 1); 16 17$z = imap_headerinfo($stream_id, 1); 18 19$fields = array ('toaddress','to','fromaddress','from', 20'reply_toaddress','reply_to', 21 'senderaddress', 'sender', 22'subject','Subject', 23 'Recent','Unseen','Flagged','Answered','Deleted','Draft', 24 'Msgno','MailDate','Size','udate'); 25 26echo "Check general fields\n"; 27foreach ($fields as $key) { 28 var_dump(isset($z->$key)); 29} 30 31echo "Check type\n"; 32var_dump($z->toaddress); 33var_dump($z->fromaddress); 34var_dump($z->reply_toaddress); 35var_dump($z->senderaddress); 36var_dump($z->subject); 37var_dump($z->Subject); 38 39if ($z->Recent == 'R' || $z->Recent == 'N' || $z->Recent == ' ') { 40 echo "Recent: OK"; 41} else { 42 echo "Recent: error: ".$z->Recent; 43} 44echo "\n"; 45 46if ($z->Unseen == 'U' || $z->Unseen == ' ') { 47 echo "Unseen: OK"; 48} else { 49 echo "Unseen: error: ".$z->Unseen; 50} 51echo "\n"; 52 53if ($z->Flagged == 'F' || $z->Flagged == ' ') { 54 echo "Flagged: OK"; 55} else { 56 echo "Flagged: error: ".$z->Flagged; 57} 58echo "\n"; 59 60if ($z->Answered == 'A' || $z->Answered == ' ') { 61 echo "Answered: OK"; 62} else { 63 echo "Answered: error"; 64} 65echo "\n"; 66 67if ($z->Deleted == 'D' || $z->Deleted == ' ') { 68 echo "Deleted: OK"; 69} else { 70 echo "Deleted: error"; 71} 72echo "\n"; 73 74if ($z->Draft == 'X' || $z->Draft == ' ') { 75 echo "Draft: OK"; 76} else { 77 echo "Draft: error"; 78} 79echo "\n"; 80 81var_dump($z->Msgno); 82var_dump($z->Size); 83var_dump($z->udate); 84 85imap_close($stream_id); 86 87?> 88--CLEAN-- 89<?php 90$mailbox_suffix = 'imapheaderinfobasic'; 91require_once('setup/clean.inc'); 92?> 93--EXPECTF-- 94Create a temporary mailbox and add 1 msgs 95New mailbox created 96Check general fields 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) 115bool(true) 116bool(true) 117Check type 118string(%d) "%s" 119string(%d) "%s" 120string(%d) "%s" 121string(%d) "%s" 122string(%d) "%s" 123string(%d) "%s" 124Recent: OK 125Unseen: OK 126Flagged: OK 127Answered: OK 128Deleted: OK 129Draft: OK 130string(%d) "%s" 131string(%d) "%d" 132int(%d) 133