Annotation of embedaddon/php/ext/standard/tests/image/image_type_to_mime_type_variation1.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test image_type_to_mime_type() function : usage variations  - Pass different data types as imagetype
                      3: --FILE--
                      4: <?php
                      5: /* Prototype  : string image_type_to_mime_type(int imagetype)
                      6:  * Description: Get Mime-Type for image-type returned by getimagesize, exif_read_data, exif_thumbnail, exif_imagetype 
                      7:  * Source code: ext/standard/image.c
                      8:  */
                      9: 
                     10: echo "*** Testing image_type_to_mime_type() : usage variations ***\n";
                     11: 
                     12: error_reporting(E_ALL ^ E_NOTICE);
                     13: 
                     14: //get an unset variable
                     15: $unset_var = 10;
                     16: unset ($unset_var);
                     17: 
                     18: class MyClass
                     19: {
                     20:   function __toString() {
                     21:     return "MyClass";
                     22:   }
                     23: }
                     24: 
                     25: //array of values to iterate over
                     26: $values = array(
                     27: 
                     28:       // float data
                     29:       100.5,
                     30:       -100.5,
                     31:       100.1234567e10,
                     32:       100.7654321E-10,
                     33:       .5,
                     34: 
                     35:       // array data
                     36:       array(),
                     37:       array('color' => 'red', 'item' => 'pen'),
                     38: 
                     39:       // null data
                     40:       NULL,
                     41:       null,
                     42: 
                     43:       // boolean data
                     44:       true,
                     45:       false,
                     46:       TRUE,
                     47:       FALSE,
                     48: 
                     49:       // empty data
                     50:       "",
                     51:       '',
                     52: 
                     53:       // string data
                     54:       "string",
                     55:       'string',
                     56: 
                     57:       // object data
                     58:       new MyClass(),
                     59: 
                     60:       // undefined data
                     61:       @$undefined_var,
                     62: 
                     63:       // unset data
                     64:       @$unset_var,
                     65: );
                     66: 
                     67: // loop through each element of the array for imagetype
                     68: $iterator = 1;
                     69: foreach($values as $value) {
                     70:       echo "\n-- Iteration $iterator --\n";
                     71:       var_dump( image_type_to_mime_type($value) );
                     72:       $iterator++;
                     73: };
                     74: ?>
                     75: ===DONE===
                     76: --EXPECTF--
                     77: *** Testing image_type_to_mime_type() : usage variations ***
                     78: 
                     79: -- Iteration 1 --
                     80: string(24) "application/octet-stream"
                     81: 
                     82: -- Iteration 2 --
                     83: string(24) "application/octet-stream"
                     84: 
                     85: -- Iteration 3 --
                     86: string(24) "application/octet-stream"
                     87: 
                     88: -- Iteration 4 --
                     89: string(24) "application/octet-stream"
                     90: 
                     91: -- Iteration 5 --
                     92: string(24) "application/octet-stream"
                     93: 
                     94: -- Iteration 6 --
                     95: 
                     96: Warning: image_type_to_mime_type() expects parameter 1 to be long, array given in %s on line %d
                     97: NULL
                     98: 
                     99: -- Iteration 7 --
                    100: 
                    101: Warning: image_type_to_mime_type() expects parameter 1 to be long, array given in %s on line %d
                    102: NULL
                    103: 
                    104: -- Iteration 8 --
                    105: string(24) "application/octet-stream"
                    106: 
                    107: -- Iteration 9 --
                    108: string(24) "application/octet-stream"
                    109: 
                    110: -- Iteration 10 --
                    111: string(9) "image/gif"
                    112: 
                    113: -- Iteration 11 --
                    114: string(24) "application/octet-stream"
                    115: 
                    116: -- Iteration 12 --
                    117: string(9) "image/gif"
                    118: 
                    119: -- Iteration 13 --
                    120: string(24) "application/octet-stream"
                    121: 
                    122: -- Iteration 14 --
                    123: 
                    124: Warning: image_type_to_mime_type() expects parameter 1 to be long, string given in %s on line %d
                    125: NULL
                    126: 
                    127: -- Iteration 15 --
                    128: 
                    129: Warning: image_type_to_mime_type() expects parameter 1 to be long, string given in %s on line %d
                    130: NULL
                    131: 
                    132: -- Iteration 16 --
                    133: 
                    134: Warning: image_type_to_mime_type() expects parameter 1 to be long, string given in %s on line %d
                    135: NULL
                    136: 
                    137: -- Iteration 17 --
                    138: 
                    139: Warning: image_type_to_mime_type() expects parameter 1 to be long, string given in %s on line %d
                    140: NULL
                    141: 
                    142: -- Iteration 18 --
                    143: 
                    144: Warning: image_type_to_mime_type() expects parameter 1 to be long, object given in %s on line %d
                    145: NULL
                    146: 
                    147: -- Iteration 19 --
                    148: string(24) "application/octet-stream"
                    149: 
                    150: -- Iteration 20 --
                    151: string(24) "application/octet-stream"
                    152: ===DONE===

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