Annotation of embedaddon/php/ext/standard/tests/image/image_type_to_extension.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: image_type_to_extension()
3: --SKIPIF--
4: <?php
5: if (!function_exists('image_type_to_extension')) die('skip image_type_to_extension() not available');
6: require_once('skipif_imagetype.inc');
7: ?>
8: --FILE--
9: <?php
10: $constants = array(
11: "IMAGETYPE_GIF" => IMAGETYPE_GIF,
12: "IMAGETYPE_JPEG" => IMAGETYPE_JPEG,
13: "IMAGETYPE_PNG" => IMAGETYPE_PNG,
14: "IMAGETYPE_SWF" => IMAGETYPE_SWF,
15: "IMAGETYPE_PSD" => IMAGETYPE_PSD,
16: "IMAGETYPE_BMP" => IMAGETYPE_BMP,
17: "IMAGETYPE_TIFF_II" => IMAGETYPE_TIFF_II,
18: "IMAGETYPE_TIFF_MM" => IMAGETYPE_TIFF_MM,
19: "IMAGETYPE_JPC" => IMAGETYPE_JPC,
20: "IMAGETYPE_JP2" => IMAGETYPE_JP2,
21: "IMAGETYPE_JPX" => IMAGETYPE_JPX,
22: "IMAGETYPE_JB2" => IMAGETYPE_JB2,
23: "IMAGETYPE_IFF" => IMAGETYPE_IFF,
24: "IMAGETYPE_WBMP" => IMAGETYPE_WBMP,
25: "IMAGETYPE_JPEG2000" => IMAGETYPE_JPEG2000,
26: "IMAGETYPE_XBM" => IMAGETYPE_XBM
27: );
28: foreach($constants as $name => $constant) {
29: printf("Constant: %s\n\tWith dot: %s\n\tWithout dot: %s\n", $name, image_type_to_extension($constant), image_type_to_extension($constant, false));
30: }
31:
32: var_dump(image_type_to_extension(-1, array()));
33: var_dump(image_type_to_extension(new stdclass));
34: var_dump(image_type_to_extension(1000000, NULL));
35: var_dump(image_type_to_extension());
36: var_dump(image_type_to_extension(0));
37: var_dump(image_type_to_extension(0, 0, 0));
38: ?>
39: Done
40: --EXPECTF--
41: Constant: IMAGETYPE_GIF
42: With dot: .gif
43: Without dot: gif
44: Constant: IMAGETYPE_JPEG
45: With dot: .jpeg
46: Without dot: jpeg
47: Constant: IMAGETYPE_PNG
48: With dot: .png
49: Without dot: png
50: Constant: IMAGETYPE_SWF
51: With dot: .swf
52: Without dot: swf
53: Constant: IMAGETYPE_PSD
54: With dot: .psd
55: Without dot: psd
56: Constant: IMAGETYPE_BMP
57: With dot: .bmp
58: Without dot: bmp
59: Constant: IMAGETYPE_TIFF_II
60: With dot: .tiff
61: Without dot: tiff
62: Constant: IMAGETYPE_TIFF_MM
63: With dot: .tiff
64: Without dot: tiff
65: Constant: IMAGETYPE_JPC
66: With dot: .jpc
67: Without dot: jpc
68: Constant: IMAGETYPE_JP2
69: With dot: .jp2
70: Without dot: jp2
71: Constant: IMAGETYPE_JPX
72: With dot: .jpx
73: Without dot: jpx
74: Constant: IMAGETYPE_JB2
75: With dot: .jb2
76: Without dot: jb2
77: Constant: IMAGETYPE_IFF
78: With dot: .iff
79: Without dot: iff
80: Constant: IMAGETYPE_WBMP
81: With dot: .bmp
82: Without dot: bmp
83: Constant: IMAGETYPE_JPEG2000
84: With dot: .jpc
85: Without dot: jpc
86: Constant: IMAGETYPE_XBM
87: With dot: .xbm
88: Without dot: xbm
89:
90: Warning: image_type_to_extension() expects parameter 2 to be boolean, array given in %s on line %d
91: bool(false)
92:
93: Warning: image_type_to_extension() expects parameter 1 to be long, object given in %s on line %d
94: bool(false)
95: bool(false)
96:
97: Warning: image_type_to_extension() expects at least 1 parameter, 0 given in %s on line %d
98: bool(false)
99: bool(false)
100:
101: Warning: image_type_to_extension() expects at most 2 parameters, 3 given in %s on line %d
102: bool(false)
103: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>