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

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

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