Annotation of embedaddon/php/ext/imap/tests/imap_fetchbody_variation4.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Test imap_fetchbody() function : usage variations - FT_UID option
        !             3: --SKIPIF--
        !             4: <?php
        !             5: require_once(dirname(__FILE__).'/skipif.inc');
        !             6: ?>
        !             7: --FILE--
        !             8: <?php
        !             9: /* Prototype  : string imap_fetchbody(resource $stream_id, int $msg_no, string $section [, int $options])
        !            10:  * Description: Get a specific body section 
        !            11:  * Source code: ext/imap/php_imap.c
        !            12:  */
        !            13: 
        !            14: /*
        !            15:  * Test if FT_UID is set by passing the following as $options argument to imap_fetchbody():
        !            16:  * 1. values that equate to 1
        !            17:  * 2. Minimum and maximum PHP values
        !            18:  */
        !            19: echo "*** Testing imap_fetchbody() : usage variations ***\n";
        !            20: 
        !            21: require_once(dirname(__FILE__).'/imap_include.inc');
        !            22: 
        !            23: // Initialise required variables
        !            24: $stream_id = setup_test_mailbox('', 1); // set up temporary mailbox with one simple message
        !            25: $msg_no = 1;
        !            26: $msg_uid = imap_uid($stream_id, $msg_no);
        !            27: $section = 1;
        !            28: 
        !            29: //Note: the first four values are valid as they will all be cast to 1L.
        !            30: $options = array ('1', true, 
        !            31:                   1.000000000000001, 0.00001e5, 
        !            32:                   PHP_INT_MAX, -PHP_INT_MAX);
        !            33: 
        !            34: // iterate over each element of $options array to test whether FT_UID is set
        !            35: $iterator = 1;
        !            36: imap_check($stream_id);
        !            37: foreach($options as $option) {
        !            38:        echo "\n-- Iteration $iterator --\n";
        !            39:        if(is_string(imap_fetchbody($stream_id, $msg_uid, $section, $option))) {
        !            40:                echo "FT_UID valid\n";
        !            41:        } else {
        !            42:                 echo "FT_UID not valid\n";
        !            43:         }
        !            44:        $iterator++;
        !            45: }
        !            46: 
        !            47: ?>
        !            48: ===DONE===
        !            49: --CLEAN--
        !            50: <?php
        !            51: require_once(dirname(__FILE__).'/clean.inc');
        !            52: ?>
        !            53: --EXPECTF--
        !            54: *** Testing imap_fetchbody() : usage variations ***
        !            55: Create a temporary mailbox and add 1 msgs
        !            56: .. mailbox '{%s}%s' created
        !            57: 
        !            58: -- Iteration 1 --
        !            59: FT_UID valid
        !            60: 
        !            61: -- Iteration 2 --
        !            62: FT_UID valid
        !            63: 
        !            64: -- Iteration 3 --
        !            65: FT_UID valid
        !            66: 
        !            67: -- Iteration 4 --
        !            68: FT_UID valid
        !            69: 
        !            70: -- Iteration 5 --
        !            71: 
        !            72: Warning: imap_fetchbody(): invalid value for the options parameter in %s on line %d
        !            73: FT_UID not valid
        !            74: 
        !            75: -- Iteration 6 --
        !            76: 
        !            77: Warning: imap_fetchbody(): invalid value for the options parameter in %s on line %d
        !            78: FT_UID not valid
        !            79: ===DONE===

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