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

1.1       misho       1: --TEST--
                      2: Test getimagesize() function : variation - Passing non image files
                      3: --FILE--
                      4: <?php
                      5: /* Prototype  : array getimagesize(string imagefile [, array info])
                      6:  * Description: Get the size of an image as 4-element array 
                      7:  * Source code: ext/standard/image.c
                      8:  */
                      9: 
                     10: 
                     11: $file_types_array = array (
                     12:     //File containing text string
                     13:        "File with text data" => "test.txt",
                     14: 
                     15:        //File containing forcibly corrupted bmp image
                     16:        "File with corrupted BMP data" => "200x100_unknown.unknown",
                     17: 
                     18:     //File which doesn't exist
                     19:      "Non-existent file" => "nofile.ext",
                     20: 
                     21:     //File having no data
                     22:     "Empty File" => "blank_file.bmp"
                     23: );
                     24: 
                     25: echo "*** Testing getimagesize() : variation ***\n";
                     26: 
                     27: //loop through each element of the array for filename
                     28: foreach($file_types_array as $key => $filename) {
                     29:       echo "\n-- $key ($filename) --\n";
                     30:       var_dump( getimagesize(dirname(__FILE__)."/$filename" ) );
                     31:       var_dump( getimagesize(dirname(__FILE__)."/$filename", $info) );
                     32:       var_dump( $info );
                     33: };
                     34: ?>
                     35: ===DONE===
                     36: --EXPECTF--
                     37: *** Testing getimagesize() : variation ***
                     38: 
                     39: -- File with text data (test.txt) --
                     40: bool(false)
                     41: bool(false)
                     42: array(0) {
                     43: }
                     44: 
                     45: -- File with corrupted BMP data (200x100_unknown.unknown) --
                     46: bool(false)
                     47: bool(false)
                     48: array(0) {
                     49: }
                     50: 
                     51: -- Non-existent file (nofile.ext) --
                     52: 
                     53: Warning: getimagesize(%s): failed to open stream: No such file or directory in %s on line %d
                     54: bool(false)
                     55: 
                     56: Warning: getimagesize(%s): failed to open stream: No such file or directory in %s on line %d
                     57: bool(false)
                     58: array(0) {
                     59: }
                     60: 
                     61: -- Empty File (blank_file.bmp) --
                     62: 
                     63: Notice: getimagesize(): Read error! in %s on line %d
                     64: bool(false)
                     65: 
                     66: Notice: getimagesize(): Read error! in %s on line %d
                     67: bool(false)
                     68: array(0) {
                     69: }
                     70: ===DONE===

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