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

1.1       misho       1: --TEST--
                      2: Test imap_fetchheader() function : usage variations - diff data types as $stream_id arg
                      3: --SKIPIF--
                      4: <?php
                      5: extension_loaded('imap') or die('skip imap extension not available in this build');
                      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 $stream_id argument to test behaviour of imap_fetchheader()
                     16:  */
                     17: 
                     18: echo "*** Testing imap_fetchheader() : usage variations ***\n";
                     19: 
                     20: // Initialise function arguments not being substituted
                     21: $msg_no = 1;
                     22: 
                     23: //get an unset variable
                     24: $unset_var = 10;
                     25: unset ($unset_var);
                     26: 
                     27: // get a class
                     28: class classA
                     29: {
                     30:   public function __toString() {
                     31:     return "Class A object";
                     32:   }
                     33: }
                     34: 
                     35: // heredoc string
                     36: $heredoc = <<<EOT
                     37: hello world
                     38: EOT;
                     39: 
                     40: // get different types of array
                     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 $stream_id 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: 
                     99: // loop through each element of $inputs to check the behavior of imap_fetchheader()
                    100: $iterator = 1;
                    101: foreach($inputs as $input) {
                    102:   echo "\n-- Iteration $iterator --\n";
                    103:   var_dump( imap_fetchheader($input, $msg_no) );
                    104:   $iterator++;
                    105: };
                    106: ?>
                    107: ===DONE===
                    108: --EXPECTF--
                    109: *** Testing imap_fetchheader() : usage variations ***
                    110: 
                    111: -- Iteration 1 --
                    112: 
                    113: Warning: imap_fetchheader() expects parameter 1 to be resource, integer given in %s on line %d
                    114: NULL
                    115: 
                    116: -- Iteration 2 --
                    117: 
                    118: Warning: imap_fetchheader() expects parameter 1 to be resource, integer given in %s on line %d
                    119: NULL
                    120: 
                    121: -- Iteration 3 --
                    122: 
                    123: Warning: imap_fetchheader() expects parameter 1 to be resource, integer given in %s on line %d
                    124: NULL
                    125: 
                    126: -- Iteration 4 --
                    127: 
                    128: Warning: imap_fetchheader() expects parameter 1 to be resource, integer given in %s on line %d
                    129: NULL
                    130: 
                    131: -- Iteration 5 --
                    132: 
                    133: Warning: imap_fetchheader() expects parameter 1 to be resource, double given in %s on line %d
                    134: NULL
                    135: 
                    136: -- Iteration 6 --
                    137: 
                    138: Warning: imap_fetchheader() expects parameter 1 to be resource, double given in %s on line %d
                    139: NULL
                    140: 
                    141: -- Iteration 7 --
                    142: 
                    143: Warning: imap_fetchheader() expects parameter 1 to be resource, double given in %s on line %d
                    144: NULL
                    145: 
                    146: -- Iteration 8 --
                    147: 
                    148: Warning: imap_fetchheader() expects parameter 1 to be resource, double given in %s on line %d
                    149: NULL
                    150: 
                    151: -- Iteration 9 --
                    152: 
                    153: Warning: imap_fetchheader() expects parameter 1 to be resource, double given in %s on line %d
                    154: NULL
                    155: 
                    156: -- Iteration 10 --
                    157: 
                    158: Warning: imap_fetchheader() expects parameter 1 to be resource, null given in %s on line %d
                    159: NULL
                    160: 
                    161: -- Iteration 11 --
                    162: 
                    163: Warning: imap_fetchheader() expects parameter 1 to be resource, null given in %s on line %d
                    164: NULL
                    165: 
                    166: -- Iteration 12 --
                    167: 
                    168: Warning: imap_fetchheader() expects parameter 1 to be resource, boolean given in %s on line %d
                    169: NULL
                    170: 
                    171: -- Iteration 13 --
                    172: 
                    173: Warning: imap_fetchheader() expects parameter 1 to be resource, boolean given in %s on line %d
                    174: NULL
                    175: 
                    176: -- Iteration 14 --
                    177: 
                    178: Warning: imap_fetchheader() expects parameter 1 to be resource, boolean given in %s on line %d
                    179: NULL
                    180: 
                    181: -- Iteration 15 --
                    182: 
                    183: Warning: imap_fetchheader() expects parameter 1 to be resource, boolean given in %s on line %d
                    184: NULL
                    185: 
                    186: -- Iteration 16 --
                    187: 
                    188: Warning: imap_fetchheader() expects parameter 1 to be resource, %unicode_string_optional% given in %s on line %d
                    189: NULL
                    190: 
                    191: -- Iteration 17 --
                    192: 
                    193: Warning: imap_fetchheader() expects parameter 1 to be resource, %unicode_string_optional% given in %s on line %d
                    194: NULL
                    195: 
                    196: -- Iteration 18 --
                    197: 
                    198: Warning: imap_fetchheader() expects parameter 1 to be resource, %unicode_string_optional% given in %s on line %d
                    199: NULL
                    200: 
                    201: -- Iteration 19 --
                    202: 
                    203: Warning: imap_fetchheader() expects parameter 1 to be resource, %unicode_string_optional% given in %s on line %d
                    204: NULL
                    205: 
                    206: -- Iteration 20 --
                    207: 
                    208: Warning: imap_fetchheader() expects parameter 1 to be resource, %unicode_string_optional% given in %s on line %d
                    209: NULL
                    210: 
                    211: -- Iteration 21 --
                    212: 
                    213: Warning: imap_fetchheader() expects parameter 1 to be resource, array given in %s on line %d
                    214: NULL
                    215: 
                    216: -- Iteration 22 --
                    217: 
                    218: Warning: imap_fetchheader() expects parameter 1 to be resource, array given in %s on line %d
                    219: NULL
                    220: 
                    221: -- Iteration 23 --
                    222: 
                    223: Warning: imap_fetchheader() expects parameter 1 to be resource, array given in %s on line %d
                    224: NULL
                    225: 
                    226: -- Iteration 24 --
                    227: 
                    228: Warning: imap_fetchheader() expects parameter 1 to be resource, array given in %s on line %d
                    229: NULL
                    230: 
                    231: -- Iteration 25 --
                    232: 
                    233: Warning: imap_fetchheader() expects parameter 1 to be resource, object given in %s on line %d
                    234: NULL
                    235: 
                    236: -- Iteration 26 --
                    237: 
                    238: Warning: imap_fetchheader() expects parameter 1 to be resource, null given in %s on line %d
                    239: NULL
                    240: 
                    241: -- Iteration 27 --
                    242: 
                    243: Warning: imap_fetchheader() expects parameter 1 to be resource, null given in %s on line %d
                    244: NULL
                    245: ===DONE===

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