Annotation of embedaddon/php/ext/imap/tests/imap_fetchheader_variation5.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test imap_fetchheader() function : usage variations - $msg_no argument
                      3: --SKIPIF--
                      4: <?php
                      5: require_once(dirname(__FILE__).'/skipif.inc');
                      6: ?>
                      7: --FILE--
                      8: <?php
                      9: /* Prototype  : string imap_fetchheader(resource $stream_id, int $msg_no [, int $options])
                     10:  * Description: Get the full unfiltered header for a message 
                     11:  * Source code: ext/imap/php_imap.c
                     12:  */
                     13: 
                     14: /*
                     15:  * Pass different integers and strings as $msg_no argument 
                     16:  * to test behaviour of imap_fetchheader()
                     17:  */
                     18: 
                     19: echo "*** Testing imap_fetchheader() : usage variations ***\n";
                     20: 
                     21: require_once(dirname(__FILE__).'/imap_include.inc');
                     22: 
                     23: $stream_id = setup_test_mailbox('', 3, $mailbox, 'notSimple'); // set up temp mailbox with 3 msgs
                     24: 
                     25: $sequences = array (0,     4, // out of range
                     26:                     '1,3', '1:3', // message sequences instead of numbers
                     27:                     ); 
                     28: 
                     29: foreach($sequences as $msg_no) {
                     30:        echo "\n-- \$msg_no is $msg_no --\n";
                     31:        var_dump($overview = imap_fetchheader($stream_id, $msg_no));
                     32:        if (!$overview) {
                     33:                echo imap_last_error() . "\n";
                     34:        }
                     35: }
                     36: 
                     37: // clear error stack
                     38: imap_errors();
                     39: ?>
                     40: ===DONE===
                     41: --CLEAN--
                     42: <?php
                     43: require_once(dirname(__FILE__).'/clean.inc');
                     44: ?>
                     45: --EXPECTF--
                     46: *** Testing imap_fetchheader() : usage variations ***
                     47: Create a temporary mailbox and add 3 msgs
                     48: .. mailbox '{%s}%s' created
                     49: 
                     50: -- $msg_no is 0 --
                     51: 
                     52: Warning: imap_fetchheader(): Bad message number in %s on line %d
                     53: bool(false)
                     54: 
                     55: 
                     56: -- $msg_no is 4 --
                     57: 
                     58: Warning: imap_fetchheader(): Bad message number in %s on line %d
                     59: bool(false)
                     60: 
                     61: 
                     62: -- $msg_no is 1,3 --
                     63: 
                     64: Notice: A non well formed numeric value encountered in %s on line %d
                     65: %unicode|string%(%d) "From: foo@anywhere.com
                     66: Subject: Test msg 1
                     67: To: %s
                     68: MIME-Version: 1.0
                     69: Content-Type: MULTIPART/mixed; BOUNDARY="%s"
                     70: 
                     71: "
                     72: 
                     73: -- $msg_no is 1:3 --
                     74: 
                     75: Notice: A non well formed numeric value encountered in %s on line %d
                     76: %unicode|string%(%d) "From: foo@anywhere.com
                     77: Subject: Test msg 1
                     78: To: %s
                     79: MIME-Version: 1.0
                     80: Content-Type: MULTIPART/mixed; BOUNDARY="%s"
                     81: 
                     82: "
                     83: ===DONE===

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>