Annotation of embedaddon/php/ext/exif/tests/exif_tagname_variation1.phpt, revision 1.1.1.2
1.1 misho 1: --TEST--
2: Test exif_tagname() function : usage variations - different types for index argument
3: --SKIPIF--
4: <?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
5: --FILE--
6: <?php
7:
8: /* Prototype : string exif_tagname ( string $index )
9: * Description: Get the header name for an index
10: * Source code: ext/exif/exif.c
11: */
12:
13: echo "*** Testing exif_tagname() : different types for index 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_tagname()
1.1.1.2 ! misho 81: // when $index argument is supplied with different values
1.1 misho 82:
83: echo "\n--- Testing exif_tagname() by supplying different values for 'index' argument ---\n";
84: $counter = 1;
85: foreach($values as $index) {
86: echo "-- Iteration $counter --\n";
87: var_dump( exif_tagname($index) );
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_tagname() : different types for index 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_tagname() by supplying different values for 'index' argument ---
107: -- Iteration 1 --
108: bool(false)
109: -- Iteration 2 --
110: bool(false)
111: -- Iteration 3 --
112: bool(false)
113: -- Iteration 4 --
114: bool(false)
115: -- Iteration 5 --
116: bool(false)
117: -- Iteration 6 --
118: bool(false)
119: -- Iteration 7 --
120: bool(false)
121: -- Iteration 8 --
122: bool(false)
123: -- Iteration 9 --
124: bool(false)
125: -- Iteration 10 --
126:
127: Warning: exif_tagname() expects parameter 1 to be long, array given in %s on line %d
128: NULL
129: -- Iteration 11 --
130:
131: Warning: exif_tagname() expects parameter 1 to be long, array given in %s on line %d
132: NULL
133: -- Iteration 12 --
134:
135: Warning: exif_tagname() expects parameter 1 to be long, array given in %s on line %d
136: NULL
137: -- Iteration 13 --
138:
139: Warning: exif_tagname() expects parameter 1 to be long, array given in %s on line %d
140: NULL
141: -- Iteration 14 --
142:
143: Warning: exif_tagname() expects parameter 1 to be long, array given in %s on line %d
144: NULL
145: -- Iteration 15 --
146: bool(false)
147: -- Iteration 16 --
148: bool(false)
149: -- Iteration 17 --
150: bool(false)
151: -- Iteration 18 --
152: bool(false)
153: -- Iteration 19 --
154:
155: Warning: exif_tagname() expects parameter 1 to be long, string given in %s on line %d
156: NULL
157: -- Iteration 20 --
158:
159: Warning: exif_tagname() expects parameter 1 to be long, string given in %s on line %d
160: NULL
161: -- Iteration 21 --
162: bool(false)
163: -- Iteration 22 --
164: bool(false)
165: -- Iteration 23 --
166:
167: Warning: exif_tagname() expects parameter 1 to be long, object given in %s on line %d
168: NULL
169: -- Iteration 24 --
170:
171: Warning: exif_tagname() expects parameter 1 to be long, resource given in %s on line %d
172: NULL
173: -- Iteration 25 --
174: bool(false)
175: -- Iteration 26 --
176: bool(false)
177: Done
178:
179: ?>
180: ===Done===
181:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>