Skip to content

Commit cfa9e5e

Browse files
committed
Fix useless tests
These tests are certainly not supposed to fail due to a typo in the class names, but expect this failure. We fix the typos and the expectations.
1 parent b3cc30a commit cfa9e5e

File tree

2 files changed

+329
-21
lines changed

2 files changed

+329
-21
lines changed

ext/standard/tests/array/arsort_object1.phpt

Lines changed: 164 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,17 @@ class for_string_arsort
4545

4646
// array of integer objects
4747
$unsorted_int_obj = array (
48-
1 => new for_integer_arsort(11), 2 => new for_integer_asort(66),
49-
3 => new for_integer_arsort(23), 4 => new for_integer_asort(-5),
50-
5 => new for_integer_arsort(0.001), 6 => new for_integer_asort(0)
48+
1 => new for_integer_arsort(11), 2 => new for_integer_arsort(66),
49+
3 => new for_integer_arsort(23), 4 => new for_integer_arsort(-5),
50+
5 => new for_integer_arsort(0.001), 6 => new for_integer_arsort(0)
5151
);
5252

5353
// array of string objects
5454
$unsorted_str_obj = array (
55-
"a" => new for_string_arsort("axx"), "b" => new for_string_asort("t"),
56-
"c" => new for_string_arsort("w"), "d" => new for_string_asort("py"),
57-
"e" => new for_string_arsort("apple"), "f" => new for_string_asort("Orange"),
58-
"g" => new for_string_arsort("Lemon"), "h" => new for_string_asort("aPPle")
55+
"a" => new for_string_arsort("axx"), "b" => new for_string_arsort("t"),
56+
"c" => new for_string_arsort("w"), "d" => new for_string_arsort("py"),
57+
"e" => new for_string_arsort("apple"), "f" => new for_string_arsort("Orange"),
58+
"g" => new for_string_arsort("Lemon"), "h" => new for_string_arsort("aPPle")
5959
);
6060

6161

@@ -84,10 +84,162 @@ var_dump($temp_array);
8484

8585
echo "Done\n";
8686
?>
87-
--EXPECTF--
87+
--EXPECT--
8888
*** Testing arsort() : object functionality ***
8989

90-
Fatal error: Uncaught Error: Class 'for_integer_asort' not found in %sarsort_object1.php:%d
91-
Stack trace:
92-
#0 {main}
93-
thrown in %sarsort_object1.php on line %d
90+
-- Testing arsort() by supplying various object arrays, 'flag' value is defualt --
91+
bool(true)
92+
array(6) {
93+
[2]=>
94+
object(for_integer_arsort)#2 (1) {
95+
["class_value"]=>
96+
int(66)
97+
}
98+
[3]=>
99+
object(for_integer_arsort)#3 (1) {
100+
["class_value"]=>
101+
int(23)
102+
}
103+
[1]=>
104+
object(for_integer_arsort)#1 (1) {
105+
["class_value"]=>
106+
int(11)
107+
}
108+
[5]=>
109+
object(for_integer_arsort)#5 (1) {
110+
["class_value"]=>
111+
float(0.001)
112+
}
113+
[6]=>
114+
object(for_integer_arsort)#6 (1) {
115+
["class_value"]=>
116+
int(0)
117+
}
118+
[4]=>
119+
object(for_integer_arsort)#4 (1) {
120+
["class_value"]=>
121+
int(-5)
122+
}
123+
}
124+
bool(true)
125+
array(8) {
126+
["c"]=>
127+
object(for_string_arsort)#9 (1) {
128+
["class_value"]=>
129+
string(1) "w"
130+
}
131+
["b"]=>
132+
object(for_string_arsort)#8 (1) {
133+
["class_value"]=>
134+
string(1) "t"
135+
}
136+
["d"]=>
137+
object(for_string_arsort)#10 (1) {
138+
["class_value"]=>
139+
string(2) "py"
140+
}
141+
["a"]=>
142+
object(for_string_arsort)#7 (1) {
143+
["class_value"]=>
144+
string(3) "axx"
145+
}
146+
["e"]=>
147+
object(for_string_arsort)#11 (1) {
148+
["class_value"]=>
149+
string(5) "apple"
150+
}
151+
["h"]=>
152+
object(for_string_arsort)#14 (1) {
153+
["class_value"]=>
154+
string(5) "aPPle"
155+
}
156+
["f"]=>
157+
object(for_string_arsort)#12 (1) {
158+
["class_value"]=>
159+
string(6) "Orange"
160+
}
161+
["g"]=>
162+
object(for_string_arsort)#13 (1) {
163+
["class_value"]=>
164+
string(5) "Lemon"
165+
}
166+
}
167+
168+
-- Testing arsort() by supplying various object arrays, 'flag' value is SORT_REGULAR --
169+
bool(true)
170+
array(6) {
171+
[2]=>
172+
object(for_integer_arsort)#2 (1) {
173+
["class_value"]=>
174+
int(66)
175+
}
176+
[3]=>
177+
object(for_integer_arsort)#3 (1) {
178+
["class_value"]=>
179+
int(23)
180+
}
181+
[1]=>
182+
object(for_integer_arsort)#1 (1) {
183+
["class_value"]=>
184+
int(11)
185+
}
186+
[5]=>
187+
object(for_integer_arsort)#5 (1) {
188+
["class_value"]=>
189+
float(0.001)
190+
}
191+
[6]=>
192+
object(for_integer_arsort)#6 (1) {
193+
["class_value"]=>
194+
int(0)
195+
}
196+
[4]=>
197+
object(for_integer_arsort)#4 (1) {
198+
["class_value"]=>
199+
int(-5)
200+
}
201+
}
202+
bool(true)
203+
array(8) {
204+
["c"]=>
205+
object(for_string_arsort)#9 (1) {
206+
["class_value"]=>
207+
string(1) "w"
208+
}
209+
["b"]=>
210+
object(for_string_arsort)#8 (1) {
211+
["class_value"]=>
212+
string(1) "t"
213+
}
214+
["d"]=>
215+
object(for_string_arsort)#10 (1) {
216+
["class_value"]=>
217+
string(2) "py"
218+
}
219+
["a"]=>
220+
object(for_string_arsort)#7 (1) {
221+
["class_value"]=>
222+
string(3) "axx"
223+
}
224+
["e"]=>
225+
object(for_string_arsort)#11 (1) {
226+
["class_value"]=>
227+
string(5) "apple"
228+
}
229+
["h"]=>
230+
object(for_string_arsort)#14 (1) {
231+
["class_value"]=>
232+
string(5) "aPPle"
233+
}
234+
["f"]=>
235+
object(for_string_arsort)#12 (1) {
236+
["class_value"]=>
237+
string(6) "Orange"
238+
}
239+
["g"]=>
240+
object(for_string_arsort)#13 (1) {
241+
["class_value"]=>
242+
string(5) "Lemon"
243+
}
244+
}
245+
Done

ext/standard/tests/array/arsort_object2.phpt

Lines changed: 165 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@ class for_string_arsort
5252

5353
// array of integer objects
5454
$unsorted_int_obj = array (
55-
1 => new for_integer_arsort(11, 33,2), 2 => new for_integer_asort(44, 66,3),
56-
3 => new for_integer_arsort(23, 32,6), 4 => new for_integer_asort(-88, -5,-4),
55+
1 => new for_integer_arsort(11, 33,2), 2 => new for_integer_arsort(44, 66,3),
56+
3 => new for_integer_arsort(23, 32,6), 4 => new for_integer_arsort(-88, -5,-4),
5757
);
5858

5959
// array of string objects
6060
$unsorted_str_obj = array (
61-
"a" => new for_string_arsort("axx","AXX","d"), "b" => new for_string_asort("T", "t","q"),
62-
"c" => new for_string_arsort("w", "W","c"), "d" => new for_string_asort("PY", "py","s"),
61+
"a" => new for_string_arsort("axx","AXX","d"), "b" => new for_string_arsort("T", "t","q"),
62+
"c" => new for_string_arsort("w", "W","c"), "d" => new for_string_arsort("PY", "py","s"),
6363
);
6464

6565

@@ -88,10 +88,166 @@ var_dump($temp_array);
8888

8989
echo "Done\n";
9090
?>
91-
--EXPECTF--
91+
--EXPECT--
9292
*** Testing arsort() : object functionality ***
9393

94-
Fatal error: Uncaught Error: Class 'for_integer_asort' not found in %sarsort_object2.php:%d
95-
Stack trace:
96-
#0 {main}
97-
thrown in %sarsort_object2.php on line %d
94+
-- Testing arsort() by supplying various object arrays, 'flag' value is default --
95+
bool(true)
96+
array(4) {
97+
[2]=>
98+
object(for_integer_arsort)#2 (3) {
99+
["public_class_value"]=>
100+
int(44)
101+
["private_class_value":"for_integer_arsort":private]=>
102+
int(66)
103+
["protected_class_value":protected]=>
104+
int(3)
105+
}
106+
[3]=>
107+
object(for_integer_arsort)#3 (3) {
108+
["public_class_value"]=>
109+
int(23)
110+
["private_class_value":"for_integer_arsort":private]=>
111+
int(32)
112+
["protected_class_value":protected]=>
113+
int(6)
114+
}
115+
[1]=>
116+
object(for_integer_arsort)#1 (3) {
117+
["public_class_value"]=>
118+
int(11)
119+
["private_class_value":"for_integer_arsort":private]=>
120+
int(33)
121+
["protected_class_value":protected]=>
122+
int(2)
123+
}
124+
[4]=>
125+
object(for_integer_arsort)#4 (3) {
126+
["public_class_value"]=>
127+
int(-88)
128+
["private_class_value":"for_integer_arsort":private]=>
129+
int(-5)
130+
["protected_class_value":protected]=>
131+
int(-4)
132+
}
133+
}
134+
bool(true)
135+
array(4) {
136+
["c"]=>
137+
object(for_string_arsort)#7 (3) {
138+
["public_class_value"]=>
139+
string(1) "w"
140+
["private_class_value":"for_string_arsort":private]=>
141+
string(1) "W"
142+
["protected_class_value":protected]=>
143+
string(1) "c"
144+
}
145+
["a"]=>
146+
object(for_string_arsort)#5 (3) {
147+
["public_class_value"]=>
148+
string(3) "axx"
149+
["private_class_value":"for_string_arsort":private]=>
150+
string(3) "AXX"
151+
["protected_class_value":protected]=>
152+
string(1) "d"
153+
}
154+
["b"]=>
155+
object(for_string_arsort)#6 (3) {
156+
["public_class_value"]=>
157+
string(1) "T"
158+
["private_class_value":"for_string_arsort":private]=>
159+
string(1) "t"
160+
["protected_class_value":protected]=>
161+
string(1) "q"
162+
}
163+
["d"]=>
164+
object(for_string_arsort)#8 (3) {
165+
["public_class_value"]=>
166+
string(2) "PY"
167+
["private_class_value":"for_string_arsort":private]=>
168+
string(2) "py"
169+
["protected_class_value":protected]=>
170+
string(1) "s"
171+
}
172+
}
173+
174+
-- Testing arsort() by supplying various object arrays, 'flag' value is SORT_REGULAR --
175+
bool(true)
176+
array(4) {
177+
[2]=>
178+
object(for_integer_arsort)#2 (3) {
179+
["public_class_value"]=>
180+
int(44)
181+
["private_class_value":"for_integer_arsort":private]=>
182+
int(66)
183+
["protected_class_value":protected]=>
184+
int(3)
185+
}
186+
[3]=>
187+
object(for_integer_arsort)#3 (3) {
188+
["public_class_value"]=>
189+
int(23)
190+
["private_class_value":"for_integer_arsort":private]=>
191+
int(32)
192+
["protected_class_value":protected]=>
193+
int(6)
194+
}
195+
[1]=>
196+
object(for_integer_arsort)#1 (3) {
197+
["public_class_value"]=>
198+
int(11)
199+
["private_class_value":"for_integer_arsort":private]=>
200+
int(33)
201+
["protected_class_value":protected]=>
202+
int(2)
203+
}
204+
[4]=>
205+
object(for_integer_arsort)#4 (3) {
206+
["public_class_value"]=>
207+
int(-88)
208+
["private_class_value":"for_integer_arsort":private]=>
209+
int(-5)
210+
["protected_class_value":protected]=>
211+
int(-4)
212+
}
213+
}
214+
bool(true)
215+
array(4) {
216+
["c"]=>
217+
object(for_string_arsort)#7 (3) {
218+
["public_class_value"]=>
219+
string(1) "w"
220+
["private_class_value":"for_string_arsort":private]=>
221+
string(1) "W"
222+
["protected_class_value":protected]=>
223+
string(1) "c"
224+
}
225+
["a"]=>
226+
object(for_string_arsort)#5 (3) {
227+
["public_class_value"]=>
228+
string(3) "axx"
229+
["private_class_value":"for_string_arsort":private]=>
230+
string(3) "AXX"
231+
["protected_class_value":protected]=>
232+
string(1) "d"
233+
}
234+
["b"]=>
235+
object(for_string_arsort)#6 (3) {
236+
["public_class_value"]=>
237+
string(1) "T"
238+
["private_class_value":"for_string_arsort":private]=>
239+
string(1) "t"
240+
["protected_class_value":protected]=>
241+
string(1) "q"
242+
}
243+
["d"]=>
244+
object(for_string_arsort)#8 (3) {
245+
["public_class_value"]=>
246+
string(2) "PY"
247+
["private_class_value":"for_string_arsort":private]=>
248+
string(2) "py"
249+
["protected_class_value":protected]=>
250+
string(1) "s"
251+
}
252+
}
253+
Done

0 commit comments

Comments
 (0)