Annotation of embedaddon/php/ext/exif/tests/exif_imagetype_variation1.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Test exif_imagetype() function : usage variations  - different types for filename argument
        !             3: --SKIPIF--
        !             4: <?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
        !             5: --FILE--
        !             6: <?php
        !             7: 
        !             8: /* Prototype  : int exif_imagetype  ( string $filename  )
        !             9:  * Description: Determine the type of an image
        !            10:  * Source code: ext/exif/exif.c
        !            11: */
        !            12: 
        !            13: echo "*** Testing exif_imagetype() : different types for filename argument ***\n";
        !            14: // initialize all required variables
        !            15: 
        !            16: // get an unset variable
        !            17: $unset_var = 'string_val';
        !            18: unset($unset_var);
        !            19: 
        !            20: // declaring a class
        !            21: class sample  {
        !            22:   public function __toString() {
        !            23:   return "obj'ct";
        !            24:   } 
        !            25: }
        !            26: 
        !            27: // Defining resource
        !            28: $file_handle = fopen(__FILE__, 'r');
        !            29: 
        !            30: // array with different values
        !            31: $values =  array (
        !            32: 
        !            33:   // integer values
        !            34:   0,
        !            35:   1,
        !            36:   12345,
        !            37:   -2345,
        !            38: 
        !            39:   // float values
        !            40:   10.5,
        !            41:   -10.5,
        !            42:   10.1234567e10,
        !            43:   10.7654321E-10,
        !            44:   .5,
        !            45: 
        !            46:   // array values
        !            47:   array(),
        !            48:   array(0),
        !            49:   array(1),
        !            50:   array(1, 2),
        !            51:   array('color' => 'red', 'item' => 'pen'),
        !            52: 
        !            53:   // boolean values
        !            54:   true,
        !            55:   false,
        !            56:   TRUE,
        !            57:   FALSE,
        !            58: 
        !            59:   // empty string
        !            60:   "",
        !            61:   '',
        !            62: 
        !            63:   // undefined variable
        !            64:   $undefined_var,
        !            65: 
        !            66:   // unset variable
        !            67:   $unset_var,
        !            68:   
        !            69:   // objects
        !            70:   new sample(),
        !            71: 
        !            72:   // resource
        !            73:   $file_handle,
        !            74:  
        !            75:   NULL,
        !            76:   null
        !            77: );
        !            78: 
        !            79: 
        !            80: // loop through each element of the array and check the working of exif_imagetype()
        !            81: // when $filename is supplied with different values
        !            82: 
        !            83: echo "\n--- Testing exif_imagetype() by supplying different values for 'filename' argument ---\n";
        !            84: $counter = 1;
        !            85: foreach($values as $filename) {
        !            86:   echo "-- Iteration $counter --\n";
        !            87:   var_dump( exif_imagetype($filename) );
        !            88:   $counter ++;
        !            89: }
        !            90: 
        !            91: // closing the file
        !            92: fclose($file_handle);
        !            93: 
        !            94: echo "Done\n";
        !            95: ?>
        !            96: 
        !            97: ?>
        !            98: ===Done===
        !            99: --EXPECTF--
        !           100: *** Testing exif_imagetype() : different types for filename argument ***
        !           101: 
        !           102: Notice: Undefined variable: undefined_var in %s on line %d
        !           103: 
        !           104: Notice: Undefined variable: unset_var in %s on line %d
        !           105: 
        !           106: --- Testing exif_imagetype() by supplying different values for 'filename' argument ---
        !           107: -- Iteration 1 --
        !           108: 
        !           109: Warning: exif_imagetype(0): failed to open stream: No such file or directory in %s on line %d
        !           110: bool(false)
        !           111: -- Iteration 2 --
        !           112: 
        !           113: Warning: exif_imagetype(1): failed to open stream: No such file or directory in %s on line %d
        !           114: bool(false)
        !           115: -- Iteration 3 --
        !           116: 
        !           117: Warning: exif_imagetype(12345): failed to open stream: No such file or directory in %s on line %d
        !           118: bool(false)
        !           119: -- Iteration 4 --
        !           120: 
        !           121: Warning: exif_imagetype(-2345): failed to open stream: No such file or directory in %s on line %d
        !           122: bool(false)
        !           123: -- Iteration 5 --
        !           124: 
        !           125: Warning: exif_imagetype(10.5): failed to open stream: No such file or directory in %s on line %d
        !           126: bool(false)
        !           127: -- Iteration 6 --
        !           128: 
        !           129: Warning: exif_imagetype(-10.5): failed to open stream: No such file or directory in %s on line %d
        !           130: bool(false)
        !           131: -- Iteration 7 --
        !           132: 
        !           133: Warning: exif_imagetype(101234567000): failed to open stream: No such file or directory in %s on line %d
        !           134: bool(false)
        !           135: -- Iteration 8 --
        !           136: 
        !           137: Warning: exif_imagetype(1.07654321E-9): failed to open stream: No such file or directory in %s on line %d
        !           138: bool(false)
        !           139: -- Iteration 9 --
        !           140: 
        !           141: Warning: exif_imagetype(0.5): failed to open stream: No such file or directory in %s on line %d
        !           142: bool(false)
        !           143: -- Iteration 10 --
        !           144: 
        !           145: Warning: exif_imagetype() expects parameter 1 to be string, array given in %s on line %d
        !           146: NULL
        !           147: -- Iteration 11 --
        !           148: 
        !           149: Warning: exif_imagetype() expects parameter 1 to be string, array given in %s on line %d
        !           150: NULL
        !           151: -- Iteration 12 --
        !           152: 
        !           153: Warning: exif_imagetype() expects parameter 1 to be string, array given in %s on line %d
        !           154: NULL
        !           155: -- Iteration 13 --
        !           156: 
        !           157: Warning: exif_imagetype() expects parameter 1 to be string, array given in %s on line %d
        !           158: NULL
        !           159: -- Iteration 14 --
        !           160: 
        !           161: Warning: exif_imagetype() expects parameter 1 to be string, array given in %s on line %d
        !           162: NULL
        !           163: -- Iteration 15 --
        !           164: 
        !           165: Warning: exif_imagetype(1): failed to open stream: No such file or directory in %s on line %d
        !           166: bool(false)
        !           167: -- Iteration 16 --
        !           168: 
        !           169: Warning: exif_imagetype(): Filename cannot be empty in %s on line %d
        !           170: bool(false)
        !           171: -- Iteration 17 --
        !           172: 
        !           173: Warning: exif_imagetype(1): failed to open stream: No such file or directory in %s on line %d
        !           174: bool(false)
        !           175: -- Iteration 18 --
        !           176: 
        !           177: Warning: exif_imagetype(): Filename cannot be empty in %s on line %d
        !           178: bool(false)
        !           179: -- Iteration 19 --
        !           180: 
        !           181: Warning: exif_imagetype(): Filename cannot be empty in %s on line %d
        !           182: bool(false)
        !           183: -- Iteration 20 --
        !           184: 
        !           185: Warning: exif_imagetype(): Filename cannot be empty in %s on line %d
        !           186: bool(false)
        !           187: -- Iteration 21 --
        !           188: 
        !           189: Warning: exif_imagetype(): Filename cannot be empty in %s on line %d
        !           190: bool(false)
        !           191: -- Iteration 22 --
        !           192: 
        !           193: Warning: exif_imagetype(): Filename cannot be empty in %s on line %d
        !           194: bool(false)
        !           195: -- Iteration 23 --
        !           196: 
        !           197: Warning: exif_imagetype(obj'ct): failed to open stream: No such file or directory in %s on line %d
        !           198: bool(false)
        !           199: -- Iteration 24 --
        !           200: 
        !           201: Warning: exif_imagetype() expects parameter 1 to be string, resource given in %s on line %d
        !           202: NULL
        !           203: -- Iteration 25 --
        !           204: 
        !           205: Warning: exif_imagetype(): Filename cannot be empty in %s on line %d
        !           206: bool(false)
        !           207: -- Iteration 26 --
        !           208: 
        !           209: Warning: exif_imagetype(): Filename cannot be empty in %s on line %d
        !           210: bool(false)
        !           211: Done
        !           212: 
        !           213: ?>
        !           214: ===Done===

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