Skip to content

Commit f6957df

Browse files
committed
Fix tests
1 parent ed197b2 commit f6957df

File tree

71 files changed

+411
-2068
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+411
-2068
lines changed

ext/mysqli/tests/mysqli_stmt_execute_bind.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ $stmt = null;
118118
// 12. Only list arrays are allowed
119119
$stmt = $link->prepare('SELECT label, ? AS anon, ? AS num FROM test WHERE id=?');
120120
try {
121-
$stmt->execute(['A'=>'abc', 2=>42, null=>$id]);
121+
$stmt->execute(['A'=>'abc', 2=>42, ''=>$id]);
122122
} catch (ValueError $e) {
123123
echo '[008] '.$e->getMessage()."\n";
124124
}

ext/pcre/tests/preg_replace_callback_array_error.phpt

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,6 @@ var_dump(
2121
)
2222
);
2323

24-
var_dump(
25-
preg_replace_callback_array(
26-
[
27-
'/a/' => 'b',
28-
null => function () {
29-
return 'ok';
30-
},
31-
],
32-
'a'
33-
)
34-
);
35-
3624
// backslashes
3725

3826
var_dump(
@@ -92,9 +80,6 @@ var_dump(
9280
Warning: preg_replace_callback_array(): Empty regular expression in %spreg_replace_callback_array_error.php on line %d
9381
NULL
9482

95-
Warning: preg_replace_callback_array(): Empty regular expression in %spreg_replace_callback_array_error.php on line %d
96-
NULL
97-
9883
Warning: preg_replace_callback_array(): Delimiter must not be alphanumeric, backslash, or NUL byte in %spreg_replace_callback_array_error.php on line %d
9984
NULL
10085

ext/spl/tests/iterator_049.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
--TEST--
2-
SPL: ArrayIterator with NULL key
2+
SPL: ArrayIterator with empty string key
33
--FILE--
44
<?php
55

6-
$ar = new ArrayIterator(array(NULL=>NULL));
7-
@var_dump($ar);
6+
$ar = new ArrayIterator(array(''=>NULL));
7+
var_dump($ar);
88
var_dump($ar->getArrayCopy());
99

1010
?>

ext/spl/tests/iterator_049b.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
--TEST--
2-
SPL: ArrayIterator with NULL key
2+
SPL: ArrayIterator with empty string key
33
--FILE--
44
<?php
55

66
$ar = new ArrayIterator(array(
7-
NULL=>1,
7+
''=>1,
88
"\0"=>2,
99
"\0\0"=>3,
1010
"\0\0\0"=>4,
1111
"\0*"=>5,
1212
"\0*\0"=>6,
1313
));
14-
@var_dump($ar);
14+
var_dump($ar);
1515
var_dump($ar->getArrayCopy());
1616

1717
?>

ext/spl/tests/spl_recursive_iterator_iterator_key_case.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Rohan Abraham (rohanabrahams@gmail.com)
55
TestFest London May 2009
66
--FILE--
77
<?php
8-
$ar = array("one"=>1, "two"=>2, "three"=>array("four"=>4, "five"=>5, "six"=>array("seven"=>7)), "eight"=>8, -100 => 10, NULL => "null");
8+
$ar = array("one"=>1, "two"=>2, "three"=>array("four"=>4, "five"=>5, "six"=>array("seven"=>7)), "eight"=>8, -100 => 10, '' => "null");
99
$it = new RecursiveArrayIterator($ar);
1010
$it = new RecursiveIteratorIterator($it);
1111
foreach($it as $k=>$v)

ext/standard/tests/array/005.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ $mixed_array = array(
1818
array( "1" => "one", "2" => "two", "3" => "three", "4" => "four", "5" => "five" ),
1919
array( 1 => "one", 2 => "two", 3 => 7, 4 => "four", 5 => "five" ),
2020
array( "f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2 => "float", "F" => "FFF",
21-
"blank" => "", 3 => 3.7, 5 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL, NULL => 3 ),
21+
"blank" => "", 3 => 3.7, 5 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL),
2222
array( 12, "name", 'age', '45' ),
2323
array( array("oNe", "tWo", 4), array(10, 20, 30, 40, 50), array() ),
2424
array( "one" => 1, "one" => 2, "three" => 3, 3, 4, 3 => 33, 4 => 44, 5, 6,
@@ -202,7 +202,7 @@ array(12) {
202202
[4]=>
203203
int(6)
204204
[""]=>
205-
int(3)
205+
string(5) "blank"
206206
[2]=>
207207
string(5) "float"
208208
["F"]=>

ext/standard/tests/array/array_change_key_case_variation3.phpt

Lines changed: 18 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -9,84 +9,36 @@ Test array_change_key_case() function : usage variations - different data types
99

1010
echo "*** Testing array_change_key_case() : usage variations ***\n";
1111

12-
//get an unset variable
13-
$unset_var = 10;
14-
unset ($unset_var);
15-
16-
// heredoc string
17-
$heredoc = <<<EOT
18-
hello world
19-
EOT;
20-
2112
// arrays of different data types to be passed to $input argument
22-
$inputs = array(
23-
24-
// int data
25-
/*1*/ 'int' => array(
13+
$inputs = [
14+
'int' => [
2615
0 => 'zero',
2716
1 => 'one',
2817
12345 => 'positive',
2918
-2345 => 'negative',
30-
),
31-
32-
// null data
33-
/*3*/ 'null uppercase' => array(
34-
NULL => 'null 1',
35-
),
36-
'null lowercase' => array(
37-
null => 'null 2',
38-
),
39-
40-
// boolean data
41-
/*4*/ 'bool lowercase' => array(
42-
true => 'lowert',
43-
false => 'lowerf',
44-
),
45-
'bool uppercase' => array(
46-
TRUE => 'uppert',
47-
FALSE => 'upperf',
48-
),
49-
50-
// empty data
51-
/*5*/ 'empty double quotes' => array(
52-
"" => 'emptyd',
53-
),
54-
'empty single quotes' => array(
55-
'' => 'emptys',
56-
),
57-
58-
// string data
59-
/*6*/ 'string' => array(
60-
"stringd" => 'stringd',
19+
],
20+
'bool' => [
21+
true => 'true',
22+
false => 'false',
23+
],
24+
'string' => [
6125
'strings' => 'strings',
62-
$heredoc => 'stringh',
63-
),
64-
65-
// undefined data
66-
/*8*/ 'undefined' => array(
67-
@$undefined_var => 'undefined',
68-
),
69-
70-
// unset data
71-
/*9*/ 'unset' => array(
72-
@$unset_var => 'unset',
73-
),
74-
);
26+
'' => 'emptys',
27+
],
28+
];
7529

7630
// loop through each sub-array of $inputs to check the behavior of array_change_key_case()
77-
$iterator = 1;
7831
foreach($inputs as $key => $input) {
79-
echo "\n-- Iteration $iterator : $key data --\n";
32+
echo "\n-- $key data --\n";
8033
var_dump( array_change_key_case($input, CASE_UPPER) );
81-
$iterator++;
8234
};
8335

8436
echo "Done";
8537
?>
8638
--EXPECT--
8739
*** Testing array_change_key_case() : usage variations ***
8840

89-
-- Iteration 1 : int data --
41+
-- int data --
9042
array(4) {
9143
[0]=>
9244
string(4) "zero"
@@ -98,65 +50,19 @@ array(4) {
9850
string(8) "negative"
9951
}
10052

101-
-- Iteration 2 : null uppercase data --
102-
array(1) {
103-
[""]=>
104-
string(6) "null 1"
105-
}
106-
107-
-- Iteration 3 : null lowercase data --
108-
array(1) {
109-
[""]=>
110-
string(6) "null 2"
111-
}
112-
113-
-- Iteration 4 : bool lowercase data --
53+
-- bool data --
11454
array(2) {
11555
[1]=>
116-
string(6) "lowert"
56+
string(4) "true"
11757
[0]=>
118-
string(6) "lowerf"
58+
string(5) "false"
11959
}
12060

121-
-- Iteration 5 : bool uppercase data --
61+
-- string data --
12262
array(2) {
123-
[1]=>
124-
string(6) "uppert"
125-
[0]=>
126-
string(6) "upperf"
127-
}
128-
129-
-- Iteration 6 : empty double quotes data --
130-
array(1) {
131-
[""]=>
132-
string(6) "emptyd"
133-
}
134-
135-
-- Iteration 7 : empty single quotes data --
136-
array(1) {
137-
[""]=>
138-
string(6) "emptys"
139-
}
140-
141-
-- Iteration 8 : string data --
142-
array(3) {
143-
["STRINGD"]=>
144-
string(7) "stringd"
14563
["STRINGS"]=>
14664
string(7) "strings"
147-
["HELLO WORLD"]=>
148-
string(7) "stringh"
149-
}
150-
151-
-- Iteration 9 : undefined data --
152-
array(1) {
15365
[""]=>
154-
string(9) "undefined"
155-
}
156-
157-
-- Iteration 10 : unset data --
158-
array(1) {
159-
[""]=>
160-
string(5) "unset"
66+
string(6) "emptys"
16167
}
16268
Done

ext/standard/tests/array/array_change_key_case_variation8.phpt

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ echo "*** Testing array_change_key_case() : usage variations ***\n";
1010

1111
$inputs = array (
1212
// group of escape sequences
13-
array(null => 1, NULL => 2, "\a" => 3, "\cx" => 4, "\e" => 5, "\f" => 6, "\n" => 7, "\t" => 8, "\xhh" => 9, "\ddd" => 10, "\v" => 11),
13+
array("\a" => 3, "\cx" => 4, "\e" => 5, "\f" => 6, "\n" => 7, "\t" => 8, "\xhh" => 9, "\ddd" => 10, "\v" => 11),
1414

1515
// array contains combination of capital/small letters
1616
array("lemoN" => 1, "Orange" => 2, "banana" => 3, "apple" => 4, "Test" => 5, "TTTT" => 6, "ttt" => 7, "ww" => 8, "x" => 9, "X" => 10, "oraNGe" => 11, "BANANA" => 12)
@@ -29,9 +29,7 @@ echo "Done";
2929
*** Testing array_change_key_case() : usage variations ***
3030

3131
-- $case = default --
32-
array(10) {
33-
[""]=>
34-
int(2)
32+
array(9) {
3533
["\a"]=>
3634
int(3)
3735
["\cx"]=>
@@ -53,9 +51,7 @@ array(10) {
5351
int(11)
5452
}
5553
-- $case = upper --
56-
array(10) {
57-
[""]=>
58-
int(2)
54+
array(9) {
5955
["\A"]=>
6056
int(3)
6157
["\CX"]=>

0 commit comments

Comments
 (0)