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

1.1     ! misho       1: --TEST--
        !             2: Test imap_fetchheader() function : usage variations - diff data types for $msg_no arg
        !             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 data types as $msg_no argument to test behaviour of imap_fetchheader()
        !            16:  */
        !            17: 
        !            18: echo "*** Testing imap_fetchheader() : usage variations ***\n";
        !            19: require_once(dirname(__FILE__).'/imap_include.inc');
        !            20: 
        !            21: // Initialise function arguments not being substituted
        !            22: $stream_id = setup_test_mailbox('', 1, $mailbox, 'notSimple'); // set up temp mailbox with 1 msg
        !            23: 
        !            24: //get an unset variable
        !            25: $unset_var = 10;
        !            26: unset ($unset_var);
        !            27: 
        !            28: // get a class
        !            29: class classA
        !            30: {
        !            31:   public function __toString() {
        !            32:     return "Class A object";
        !            33:   }
        !            34: }
        !            35: 
        !            36: // heredoc string
        !            37: $heredoc = <<<EOT
        !            38: hello world
        !            39: EOT;
        !            40: 
        !            41: $index_array = array (1, 2, 3);
        !            42: $assoc_array = array ('one' => 1, 'two' => 2);
        !            43: 
        !            44: // get a resource variable
        !            45: $fp = fopen(__FILE__, "r");
        !            46: 
        !            47: // unexpected values to be passed to $msg_no argument
        !            48: $inputs = array(
        !            49: 
        !            50:        // int data
        !            51: /*1*/  0,
        !            52:        1,
        !            53:        12345,
        !            54:        -2345,
        !            55: 
        !            56:        // float data
        !            57: /*5*/  10.5,
        !            58:        -10.5,
        !            59:        12.3456789000e10,
        !            60:        12.3456789000E-10,
        !            61:        .5,
        !            62: 
        !            63:        // null data
        !            64: /*10*/ NULL,
        !            65:        null,
        !            66: 
        !            67:        // boolean data
        !            68: /*12*/ true,
        !            69:        false,
        !            70:        TRUE,
        !            71:        FALSE,
        !            72:        
        !            73:        // empty data
        !            74: /*16*/ "",
        !            75:        '',
        !            76: 
        !            77:        // string data
        !            78: /*18*/ "string",
        !            79:        'string',
        !            80:        $heredoc,
        !            81:        
        !            82:        // array data
        !            83: /*21*/ array(),
        !            84:        $index_array,
        !            85:        $assoc_array,
        !            86:        array('foo', $index_array, $assoc_array),
        !            87:        
        !            88:        
        !            89:        // object data
        !            90: /*25*/ new classA(),
        !            91: 
        !            92:        // undefined data
        !            93: /*26*/ @$undefined_var,
        !            94: 
        !            95:        // unset data
        !            96: /*27*/ @$unset_var,
        !            97: 
        !            98:        // resource variable
        !            99: /*28*/ $fp
        !           100: );
        !           101: 
        !           102: // loop through each element of $inputs to check the behavior of imap_fetchheader()
        !           103: $iterator = 1;
        !           104: foreach($inputs as $input) {
        !           105:   echo "\n-- Iteration $iterator --\n";
        !           106:   var_dump( imap_fetchheader($stream_id, $input) );
        !           107:   $iterator++;
        !           108: };
        !           109: 
        !           110: fclose($fp);
        !           111: ?>
        !           112: ===DONE===
        !           113: --CLEAN--
        !           114: <?php
        !           115: require_once(dirname(__FILE__).'/clean.inc');
        !           116: ?>
        !           117: ===DONE===
        !           118: --EXPECTF--
        !           119: *** Testing imap_fetchheader() : usage variations ***
        !           120: Create a temporary mailbox and add 1 msgs
        !           121: .. mailbox '{%s}%s' created
        !           122: 
        !           123: -- Iteration 1 --
        !           124: 
        !           125: Warning: imap_fetchheader(): Bad message number in %s on line %d
        !           126: bool(false)
        !           127: 
        !           128: -- Iteration 2 --
        !           129: %unicode|string%(%d) "From: foo@anywhere.com
        !           130: Subject: Test msg 1
        !           131: To: %s
        !           132: MIME-Version: 1.0
        !           133: Content-Type: MULTIPART/mixed; BOUNDARY="%s"
        !           134: 
        !           135: "
        !           136: 
        !           137: -- Iteration 3 --
        !           138: 
        !           139: Warning: imap_fetchheader(): Bad message number in %s on line %d
        !           140: bool(false)
        !           141: 
        !           142: -- Iteration 4 --
        !           143: 
        !           144: Warning: imap_fetchheader(): Bad message number in %s on line %d
        !           145: bool(false)
        !           146: 
        !           147: -- Iteration 5 --
        !           148: 
        !           149: Warning: imap_fetchheader(): Bad message number in %s on line %d
        !           150: bool(false)
        !           151: 
        !           152: -- Iteration 6 --
        !           153: 
        !           154: Warning: imap_fetchheader(): Bad message number in %s on line %d
        !           155: bool(false)
        !           156: 
        !           157: -- Iteration 7 --
        !           158: 
        !           159: Warning: imap_fetchheader(): Bad message number in %s on line %d
        !           160: bool(false)
        !           161: 
        !           162: -- Iteration 8 --
        !           163: 
        !           164: Warning: imap_fetchheader(): Bad message number in %s on line %d
        !           165: bool(false)
        !           166: 
        !           167: -- Iteration 9 --
        !           168: 
        !           169: Warning: imap_fetchheader(): Bad message number in %s on line %d
        !           170: bool(false)
        !           171: 
        !           172: -- Iteration 10 --
        !           173: 
        !           174: Warning: imap_fetchheader(): Bad message number in %s on line %d
        !           175: bool(false)
        !           176: 
        !           177: -- Iteration 11 --
        !           178: 
        !           179: Warning: imap_fetchheader(): Bad message number in %s on line %d
        !           180: bool(false)
        !           181: 
        !           182: -- Iteration 12 --
        !           183: %unicode|string%(%d) "From: foo@anywhere.com
        !           184: Subject: Test msg 1
        !           185: To: %s
        !           186: MIME-Version: 1.0
        !           187: Content-Type: MULTIPART/mixed; BOUNDARY="%s"
        !           188: 
        !           189: "
        !           190: 
        !           191: -- Iteration 13 --
        !           192: 
        !           193: Warning: imap_fetchheader(): Bad message number in %s on line %d
        !           194: bool(false)
        !           195: 
        !           196: -- Iteration 14 --
        !           197: %unicode|string%(%d) "From: foo@anywhere.com
        !           198: Subject: Test msg 1
        !           199: To: %s
        !           200: MIME-Version: 1.0
        !           201: Content-Type: MULTIPART/mixed; BOUNDARY="%s"
        !           202: 
        !           203: "
        !           204: 
        !           205: -- Iteration 15 --
        !           206: 
        !           207: Warning: imap_fetchheader(): Bad message number in %s on line %d
        !           208: bool(false)
        !           209: 
        !           210: -- Iteration 16 --
        !           211: 
        !           212: Warning: imap_fetchheader() expects parameter 2 to be long, %unicode_string_optional% given in %s on line %d
        !           213: NULL
        !           214: 
        !           215: -- Iteration 17 --
        !           216: 
        !           217: Warning: imap_fetchheader() expects parameter 2 to be long, %unicode_string_optional% given in %s on line %d
        !           218: NULL
        !           219: 
        !           220: -- Iteration 18 --
        !           221: 
        !           222: Warning: imap_fetchheader() expects parameter 2 to be long, %unicode_string_optional% given in %s on line %d
        !           223: NULL
        !           224: 
        !           225: -- Iteration 19 --
        !           226: 
        !           227: Warning: imap_fetchheader() expects parameter 2 to be long, %unicode_string_optional% given in %s on line %d
        !           228: NULL
        !           229: 
        !           230: -- Iteration 20 --
        !           231: 
        !           232: Warning: imap_fetchheader() expects parameter 2 to be long, %unicode_string_optional% given in %s on line %d
        !           233: NULL
        !           234: 
        !           235: -- Iteration 21 --
        !           236: 
        !           237: Warning: imap_fetchheader() expects parameter 2 to be long, array given in %s on line %d
        !           238: NULL
        !           239: 
        !           240: -- Iteration 22 --
        !           241: 
        !           242: Warning: imap_fetchheader() expects parameter 2 to be long, array given in %s on line %d
        !           243: NULL
        !           244: 
        !           245: -- Iteration 23 --
        !           246: 
        !           247: Warning: imap_fetchheader() expects parameter 2 to be long, array given in %s on line %d
        !           248: NULL
        !           249: 
        !           250: -- Iteration 24 --
        !           251: 
        !           252: Warning: imap_fetchheader() expects parameter 2 to be long, array given in %s on line %d
        !           253: NULL
        !           254: 
        !           255: -- Iteration 25 --
        !           256: 
        !           257: Warning: imap_fetchheader() expects parameter 2 to be long, object given in %s on line %d
        !           258: NULL
        !           259: 
        !           260: -- Iteration 26 --
        !           261: 
        !           262: Warning: imap_fetchheader(): Bad message number in %s on line %d
        !           263: bool(false)
        !           264: 
        !           265: -- Iteration 27 --
        !           266: 
        !           267: Warning: imap_fetchheader(): Bad message number in %s on line %d
        !           268: bool(false)
        !           269: 
        !           270: -- Iteration 28 --
        !           271: 
        !           272: Warning: imap_fetchheader() expects parameter 2 to be long, resource given in %s on line %d
        !           273: NULL
        !           274: ===DONE===

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