Annotation of embedaddon/php/ext/standard/tests/strings/convert_uudecode_variation1.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test convert_uudecode() function : usage variations - test values for $data argument
                      3: --FILE--
                      4: <?php
                      5: 
                      6: /* Prototype  : string convert_uudecode  ( string $data  )
                      7:  * Description: Decode a uuencoded string
                      8:  * Source code: ext/standard/uuencode.c
                      9: */
                     10: 
                     11: echo "*** Testing convert_uudecode() function: with unexpected inputs for 'data' argument ***\n";
                     12: 
                     13: //get an unset variable
                     14: $unset_var = 'string_val';
                     15: unset($unset_var);
                     16: 
                     17: //defining a class
                     18: class sample  {
                     19:   public function __toString() {
                     20:     return "sample object";
                     21:   } 
                     22: }
                     23: 
                     24: //getting the resource
                     25: $file_handle = fopen(__FILE__, "r");
                     26: 
                     27: // array with different values for $data
                     28: $inputs =  array (
                     29: 
                     30:                  // integer values
                     31: /*1*/    0,
                     32:                  1,
                     33:                  255,
                     34:                  256,
                     35:              2147483647,
                     36:                  -2147483648,
                     37:                
                     38:                  // float values
                     39: /*7*/    10.5,
                     40:                  -20.5,
                     41:                  10.1234567e10,
                     42:                
                     43:                  // array values
                     44: /*10*/   array(),
                     45:                  array(0),
                     46:                  array(1, 2),
                     47:                
                     48:                  // boolean values
                     49: /*13*/   true,
                     50:                  false,
                     51:                  TRUE,
                     52:                  FALSE,
                     53:                
                     54:                  // null values
                     55: /*17*/   NULL,
                     56:                  null,
                     57:                
                     58:                  // objects
                     59: /*19*/   new sample(),
                     60:                
                     61:                  // resource
                     62: /*20*/   $file_handle,
                     63:                
                     64:                  // undefined variable
                     65: /*21*/   @$undefined_var,
                     66:                
                     67:                  // unset variable
                     68: /*22*/   @$unset_var
                     69: );
                     70: 
                     71: // loop through with each element of the $data array to test convert_uudecode() function
                     72: $count = 1;
                     73: foreach($inputs as $input) {
                     74:   echo "-- Iteration $count --\n";
                     75:   var_dump( convert_uudecode($input) );
                     76:   $count ++;
                     77: }
                     78: 
                     79: fclose($file_handle);  //closing the file handle
                     80: 
                     81: ?>
                     82: ===DONE===
                     83: --EXPECTF--
                     84: *** Testing convert_uudecode() function: with unexpected inputs for 'data' argument ***
                     85: -- Iteration 1 --
                     86: 
                     87: Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d
                     88: bool(false)
                     89: -- Iteration 2 --
                     90: 
                     91: Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d
                     92: bool(false)
                     93: -- Iteration 3 --
                     94: 
                     95: Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d
                     96: bool(false)
                     97: -- Iteration 4 --
                     98: 
                     99: Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d
                    100: bool(false)
                    101: -- Iteration 5 --
                    102: 
                    103: Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d
                    104: bool(false)
                    105: -- Iteration 6 --
                    106: 
                    107: Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d
                    108: bool(false)
                    109: -- Iteration 7 --
                    110: 
                    111: Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d
                    112: bool(false)
                    113: -- Iteration 8 --
                    114: 
                    115: Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d
                    116: bool(false)
                    117: -- Iteration 9 --
                    118: 
                    119: Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d
                    120: bool(false)
                    121: -- Iteration 10 --
                    122: 
                    123: Warning: convert_uudecode() expects parameter 1 to be string, array given in %s on line %d
                    124: bool(false)
                    125: -- Iteration 11 --
                    126: 
                    127: Warning: convert_uudecode() expects parameter 1 to be string, array given in %s on line %d
                    128: bool(false)
                    129: -- Iteration 12 --
                    130: 
                    131: Warning: convert_uudecode() expects parameter 1 to be string, array given in %s on line %d
                    132: bool(false)
                    133: -- Iteration 13 --
                    134: 
                    135: Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d
                    136: bool(false)
                    137: -- Iteration 14 --
                    138: bool(false)
                    139: -- Iteration 15 --
                    140: 
                    141: Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d
                    142: bool(false)
                    143: -- Iteration 16 --
                    144: bool(false)
                    145: -- Iteration 17 --
                    146: bool(false)
                    147: -- Iteration 18 --
                    148: bool(false)
                    149: -- Iteration 19 --
                    150: 
                    151: Warning: convert_uudecode(): The given parameter is not a valid uuencoded string in %s on line %d
                    152: bool(false)
                    153: -- Iteration 20 --
                    154: 
                    155: Warning: convert_uudecode() expects parameter 1 to be string, resource given in %s on line %d
                    156: bool(false)
                    157: -- Iteration 21 --
                    158: bool(false)
                    159: -- Iteration 22 --
                    160: bool(false)
                    161: ===DONE===

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