Annotation of embedaddon/php/ext/standard/tests/image/image_type_to_mime_type_variation2.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test image_type_to_mime_type() function : usage variations - Pass decimal, octal, and hexadecimal values 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: $values = array (
14: //Decimal values
15: 0,
16: 1,
17: 12345,
18: -12345,
19:
20: //Octal values
21: 02,
22: 010,
23: 030071,
24: -030071,
25:
26: //Hexadecimal values
27: 0x0,
28: 0x1,
29: 0xABCD,
30: -0xABCD
31: );
32:
33: // loop through each element of the array for imagetype
34: $iterator = 1;
35: foreach($values as $value) {
36: echo "\n-- Iteration $iterator --\n";
37: var_dump( image_type_to_mime_type($value) );
38: $iterator++;
39: };
40: ?>
41: ===DONE===
42: --EXPECT--
43: *** Testing image_type_to_mime_type() : usage variations ***
44:
45: -- Iteration 1 --
46: string(24) "application/octet-stream"
47:
48: -- Iteration 2 --
49: string(9) "image/gif"
50:
51: -- Iteration 3 --
52: string(24) "application/octet-stream"
53:
54: -- Iteration 4 --
55: string(24) "application/octet-stream"
56:
57: -- Iteration 5 --
58: string(10) "image/jpeg"
59:
60: -- Iteration 6 --
61: string(10) "image/tiff"
62:
63: -- Iteration 7 --
64: string(24) "application/octet-stream"
65:
66: -- Iteration 8 --
67: string(24) "application/octet-stream"
68:
69: -- Iteration 9 --
70: string(24) "application/octet-stream"
71:
72: -- Iteration 10 --
73: string(9) "image/gif"
74:
75: -- Iteration 11 --
76: string(24) "application/octet-stream"
77:
78: -- Iteration 12 --
79: string(24) "application/octet-stream"
80: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>