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

1.1       misho       1: --TEST--
                      2: Test imap_fetch_overview() 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  : array imap_fetch_overview(resource $stream_id, int $msg_no [, int $options])
                     10:  * Description: Read an overview of the information in the headers 
                     11:  * of the given message sequence 
                     12:  * Source code: ext/imap/php_imap.c
                     13:  */
                     14: 
                     15: /*
                     16:  * Pass different data types as $stream_id argument to imap_fetch_overview() to test behaviour
                     17:  */
                     18: 
                     19: echo "*** Testing imap_fetch_overview() : usage variations ***\n";
                     20: 
                     21: // Initialise function arguments not being substituted
                     22: $msg_no = 1;
                     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: // unexpected values to be passed to $stream_id argument
                     42: $inputs = array(
                     43: 
                     44:        // int data
                     45: /*1*/  0,
                     46:        1,
                     47:        12345,
                     48:        -2345,
                     49: 
                     50:        // float data
                     51: /*5*/  10.5,
                     52:        -10.5,
                     53:        12.3456789000e10,
                     54:        12.3456789000E-10,
                     55:        .5,
                     56: 
                     57:        // null data
                     58: /*10*/ NULL,
                     59:        null,
                     60: 
                     61:        // boolean data
                     62: /*12*/ true,
                     63:        false,
                     64:        TRUE,
                     65:        FALSE,
                     66:        
                     67:        // empty data
                     68: /*16*/ "",
                     69:        '',
                     70:        array(),
                     71: 
                     72:        // string data
                     73: /*19*/ "string",
                     74:        'string',
                     75:        $heredoc,
                     76:        
                     77:        // object data
                     78: /*22*/ new classA(),
                     79: 
                     80:        // undefined data
                     81: /*23*/ @$undefined_var,
                     82: 
                     83:        // unset data
                     84: /*24*/ @$unset_var,
                     85: );
                     86: 
                     87: // loop through each element of $inputs to check the behavior of imap_fetch_overview()
                     88: $iterator = 1;
                     89: foreach($inputs as $input) {
                     90:   echo "\n-- Testing with first argument value: ";
                     91:   var_dump($input);
                     92:   var_dump( imap_fetch_overview($input, $msg_no) );
                     93:   $iterator++;
                     94: };
                     95: ?>
                     96: ===DONE===
                     97: --EXPECTF--
                     98: *** Testing imap_fetch_overview() : usage variations ***
                     99: 
                    100: -- Testing with first argument value: int(0)
                    101: 
                    102: Warning: imap_fetch_overview() expects parameter 1 to be resource, integer given in %s on line %d
                    103: NULL
                    104: 
                    105: -- Testing with first argument value: int(1)
                    106: 
                    107: Warning: imap_fetch_overview() expects parameter 1 to be resource, integer given in %s on line %d
                    108: NULL
                    109: 
                    110: -- Testing with first argument value: int(12345)
                    111: 
                    112: Warning: imap_fetch_overview() expects parameter 1 to be resource, integer given in %s on line %d
                    113: NULL
                    114: 
                    115: -- Testing with first argument value: int(-2345)
                    116: 
                    117: Warning: imap_fetch_overview() expects parameter 1 to be resource, integer given in %s on line %d
                    118: NULL
                    119: 
                    120: -- Testing with first argument value: float(10.5)
                    121: 
                    122: Warning: imap_fetch_overview() expects parameter 1 to be resource, double given in %s on line %d
                    123: NULL
                    124: 
                    125: -- Testing with first argument value: float(-10.5)
                    126: 
                    127: Warning: imap_fetch_overview() expects parameter 1 to be resource, double given in %s on line %d
                    128: NULL
                    129: 
                    130: -- Testing with first argument value: float(123456789000)
                    131: 
                    132: Warning: imap_fetch_overview() expects parameter 1 to be resource, double given in %s on line %d
                    133: NULL
                    134: 
                    135: -- Testing with first argument value: float(1.23456789E-9)
                    136: 
                    137: Warning: imap_fetch_overview() expects parameter 1 to be resource, double given in %s on line %d
                    138: NULL
                    139: 
                    140: -- Testing with first argument value: float(0.5)
                    141: 
                    142: Warning: imap_fetch_overview() expects parameter 1 to be resource, double given in %s on line %d
                    143: NULL
                    144: 
                    145: -- Testing with first argument value: NULL
                    146: 
                    147: Warning: imap_fetch_overview() expects parameter 1 to be resource, null given in %s on line %d
                    148: NULL
                    149: 
                    150: -- Testing with first argument value: NULL
                    151: 
                    152: Warning: imap_fetch_overview() expects parameter 1 to be resource, null given in %s on line %d
                    153: NULL
                    154: 
                    155: -- Testing with first argument value: bool(true)
                    156: 
                    157: Warning: imap_fetch_overview() expects parameter 1 to be resource, boolean given in %s on line %d
                    158: NULL
                    159: 
                    160: -- Testing with first argument value: bool(false)
                    161: 
                    162: Warning: imap_fetch_overview() expects parameter 1 to be resource, boolean given in %s on line %d
                    163: NULL
                    164: 
                    165: -- Testing with first argument value: bool(true)
                    166: 
                    167: Warning: imap_fetch_overview() expects parameter 1 to be resource, boolean given in %s on line %d
                    168: NULL
                    169: 
                    170: -- Testing with first argument value: bool(false)
                    171: 
                    172: Warning: imap_fetch_overview() expects parameter 1 to be resource, boolean given in %s on line %d
                    173: NULL
                    174: 
                    175: -- Testing with first argument value: %string|unicode%(0) ""
                    176: 
                    177: Warning: imap_fetch_overview() expects parameter 1 to be resource, %unicode_string_optional% given in %s on line %d
                    178: NULL
                    179: 
                    180: -- Testing with first argument value: %string|unicode%(0) ""
                    181: 
                    182: Warning: imap_fetch_overview() expects parameter 1 to be resource, %unicode_string_optional% given in %s on line %d
                    183: NULL
                    184: 
                    185: -- Testing with first argument value: array(0) {
                    186: }
                    187: 
                    188: Warning: imap_fetch_overview() expects parameter 1 to be resource, array given in %s on line %d
                    189: NULL
                    190: 
                    191: -- Testing with first argument value: %string|unicode%(6) "string"
                    192: 
                    193: Warning: imap_fetch_overview() expects parameter 1 to be resource, %unicode_string_optional% given in %s on line %d
                    194: NULL
                    195: 
                    196: -- Testing with first argument value: %string|unicode%(6) "string"
                    197: 
                    198: Warning: imap_fetch_overview() expects parameter 1 to be resource, %unicode_string_optional% given in %s on line %d
                    199: NULL
                    200: 
                    201: -- Testing with first argument value: %string|unicode%(11) "hello world"
                    202: 
                    203: Warning: imap_fetch_overview() expects parameter 1 to be resource, %unicode_string_optional% given in %s on line %d
                    204: NULL
                    205: 
                    206: -- Testing with first argument value: object(classA)#1 (0) {
                    207: }
                    208: 
                    209: Warning: imap_fetch_overview() expects parameter 1 to be resource, object given in %s on line %d
                    210: NULL
                    211: 
                    212: -- Testing with first argument value: NULL
                    213: 
                    214: Warning: imap_fetch_overview() expects parameter 1 to be resource, null given in %s on line %d
                    215: NULL
                    216: 
                    217: -- Testing with first argument value: NULL
                    218: 
                    219: Warning: imap_fetch_overview() expects parameter 1 to be resource, null given in %s on line %d
                    220: NULL
                    221: ===DONE===

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