Skip to content

Commit af4eabd

Browse files
committed
Remove unnecessary requires in mysqli tests
1 parent 2fbec09 commit af4eabd

File tree

92 files changed

+103
-274
lines changed

Some content is hidden

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

92 files changed

+103
-274
lines changed

ext/mysqli/tests/gracefull_fail_on_empty_result_set.phpt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ require_once 'skipifconnectfailure.inc';
99
--FILE--
1010
<?php
1111
require_once 'connect.inc';
12-
require 'table.inc';
12+
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
13+
printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
14+
$host, $user, $db, $port, $socket);
15+
exit(1);
16+
}
1317

1418
// Returns only one result set
1519
$link->multi_query("SELECT 1");
@@ -24,10 +28,6 @@ require_once 'skipifconnectfailure.inc';
2428

2529
$link->close();
2630
?>
27-
--CLEAN--
28-
<?php
29-
require_once 'clean_table.inc';
30-
?>
3131
--EXPECT--
3232
bool(false)
3333
object(mysqli_result)#3 (5) {

ext/mysqli/tests/mysqli_class_mysqli_result_interface.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ require_once 'skipifconnectfailure.inc';
88
?>
99
--FILE--
1010
<?php
11-
require 'connect.inc';
1211
require 'table.inc';
1312

1413
$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket);

ext/mysqli/tests/mysqli_class_mysqli_stmt_interface.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ mysqli
88
?>
99
--FILE--
1010
<?php
11-
require 'connect.inc';
1211
require 'table.inc';
1312

1413
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);

ext/mysqli/tests/mysqli_data_seek.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ require_once 'skipifconnectfailure.inc';
88
?>
99
--FILE--
1010
<?php
11-
require_once 'connect.inc';
12-
1311
require 'table.inc';
1412
if (!$res = mysqli_query($link, 'SELECT * FROM test ORDER BY id LIMIT 4', MYSQLI_STORE_RESULT))
1513
printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));

ext/mysqli/tests/mysqli_data_seek_oo.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ require_once 'skipifconnectfailure.inc';
88
?>
99
--FILE--
1010
<?php
11-
require_once 'connect.inc';
1211
require 'table.inc';
1312

1413
if (!$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket))

ext/mysqli/tests/mysqli_fetch_all.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ require_once 'skipifconnectfailure.inc';
88
?>
99
--FILE--
1010
<?php
11-
require_once 'connect.inc';
12-
1311
require 'table.inc';
1412
if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT 2")) {
1513
printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));

ext/mysqli/tests/mysqli_fetch_all_oo.phpt

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,8 @@ require_once 'skipifconnectfailure.inc';
88
?>
99
--FILE--
1010
<?php
11-
require_once 'connect.inc';
12-
13-
$tmp = NULL;
14-
$link = NULL;
15-
16-
$mysqli = new mysqli();
17-
18-
if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
19-
printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
20-
$host, $user, $db, $port, $socket);
21-
2211
require 'table.inc';
12+
$mysqli = $link;
2313
if (!$res = $mysqli->query("SELECT * FROM test ORDER BY id LIMIT 2")) {
2414
printf("[004] [%d] %s\n", $mysqli->errno, $mysqli->error);
2515
}

ext/mysqli/tests/mysqli_fetch_array.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ require_once 'skipifconnectfailure.inc';
88
?>
99
--FILE--
1010
<?php
11-
require_once 'connect.inc';
12-
1311
require 'table.inc';
1412
if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT 5")) {
1513
printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));

ext/mysqli/tests/mysqli_fetch_array_oo.phpt

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,8 @@ require_once 'skipifconnectfailure.inc';
88
?>
99
--FILE--
1010
<?php
11-
require_once 'connect.inc';
12-
13-
$tmp = NULL;
14-
$link = NULL;
15-
1611
require 'table.inc';
17-
if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
18-
printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
19-
$host, $user, $db, $port, $socket);
12+
$mysqli = $link;
2013

2114
if (!$res = $mysqli->query("SELECT * FROM test ORDER BY id LIMIT 5")) {
2215
printf("[004] [%d] %s\n", $mysqli->errno, $mysqli->error);

ext/mysqli/tests/mysqli_fetch_assoc.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ require_once 'skipifconnectfailure.inc';
88
?>
99
--FILE--
1010
<?php
11-
require_once 'connect.inc';
12-
1311
// Note: no SQL type tests, internally the same function gets used as for mysqli_fetch_array() which does a lot of SQL type test
1412

1513
require 'table.inc';

ext/mysqli/tests/mysqli_fetch_assoc_no_alias_utf8.phpt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,12 @@ mysqli
3434
?>
3535
--FILE--
3636
<?php
37-
require 'table.inc';
37+
require_once 'connect.inc';
38+
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
39+
printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
40+
$host, $user, $db, $port, $socket);
41+
exit(1);
42+
}
3843

3944
/* some cyrillic (utf8) comes here */
4045
if (!$res = mysqli_query($link, "SET NAMES UTF8")) {
@@ -77,10 +82,6 @@ mysqli
7782
mysqli_close($link);
7883
print "done!";
7984
?>
80-
--CLEAN--
81-
<?php
82-
require_once 'clean_table.inc';
83-
?>
8485
--EXPECTF--
8586
[003]
8687
array(3) {

ext/mysqli/tests/mysqli_fetch_assoc_oo.phpt

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@ require_once 'skipifconnectfailure.inc';
88
?>
99
--FILE--
1010
<?php
11-
require_once 'connect.inc';
12-
13-
$tmp = NULL;
14-
$link = NULL;
15-
1611
// Note: no SQL type tests, internally the same function gets used as for mysqli_fetch_array() which does a lot of SQL type test
1712
$mysqli = new mysqli();
1813
try {
@@ -22,9 +17,7 @@ require_once 'skipifconnectfailure.inc';
2217
}
2318

2419
require 'table.inc';
25-
if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
26-
printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
27-
$host, $user, $db, $port, $socket);
20+
$mysqli = $link;
2821

2922
if (!$res = $mysqli->query("SELECT id, label FROM test ORDER BY id LIMIT 1")) {
3023
printf("[004] [%d] %s\n", $mysqli->errno, $mysqli->error);

ext/mysqli/tests/mysqli_fetch_column.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ require_once 'skipifconnectfailure.inc';
88
?>
99
--FILE--
1010
<?php
11-
12-
require_once 'connect.inc';
1311
require 'table.inc';
1412
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
1513

ext/mysqli/tests/mysqli_fetch_field.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ require_once 'skipifconnectfailure.inc';
88
?>
99
--FILE--
1010
<?php
11-
require_once 'connect.inc';
12-
1311
// Note: no SQL type tests, internally the same function gets used as for mysqli_fetch_array() which does a lot of SQL type test
1412

1513
require 'table.inc';

ext/mysqli/tests/mysqli_fetch_field_direct.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ require_once 'skipifconnectfailure.inc';
88
?>
99
--FILE--
1010
<?php
11-
require_once 'connect.inc';
12-
1311
require 'table.inc';
1412

1513
if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 1")) {

ext/mysqli/tests/mysqli_fetch_field_direct_oo.phpt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ require_once 'skipifconnectfailure.inc';
88
?>
99
--FILE--
1010
<?php
11-
require_once 'connect.inc';
12-
1311
$mysqli = new mysqli();
1412
try {
1513
new mysqli_result($mysqli);
@@ -18,10 +16,7 @@ require_once 'skipifconnectfailure.inc';
1816
}
1917

2018
require 'table.inc';
21-
22-
if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
23-
printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
24-
$host, $user, $db, $port, $socket);
19+
$mysqli = $link;
2520

2621
if (!$res = $mysqli->query("SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 1")) {
2722
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));

ext/mysqli/tests/mysqli_fetch_field_oo.phpt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ require_once 'skipifconnectfailure.inc';
88
?>
99
--FILE--
1010
<?php
11-
require_once 'connect.inc';
12-
1311
// Note: no SQL type tests, internally the same function gets used as for mysqli_fetch_array() which does a lot of SQL type test
1412
$mysqli = new mysqli();
1513
$res = false;
@@ -20,9 +18,7 @@ require_once 'skipifconnectfailure.inc';
2018
}
2119

2220
require 'table.inc';
23-
if (!$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket))
24-
printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
25-
$host, $user, $db, $port, $socket);
21+
$mysqli = $link;
2622

2723
// Make sure that client, connection and result charsets are all the
2824
// same. Not sure whether this is strictly necessary.

ext/mysqli/tests/mysqli_fetch_fields.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ require_once 'skipifconnectfailure.inc';
88
?>
99
--FILE--
1010
<?php
11-
require_once 'connect.inc';
12-
1311
// Note: no SQL type tests, internally the same function gets used as for mysqli_fetch_array() which does a lot of SQL type test
1412

1513
require 'table.inc';

ext/mysqli/tests/mysqli_fetch_lengths.phpt

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,8 @@ require_once 'skipifconnectfailure.inc';
88
?>
99
--FILE--
1010
<?php
11-
require_once 'connect.inc';
12-
13-
if (!$mysqli = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
14-
printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
15-
$host, $user, $db, $port, $socket);
16-
}
17-
1811
require 'table.inc';
12+
$mysqli = $link;
1913
if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id LIMIT 1")) {
2014
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
2115
}

ext/mysqli/tests/mysqli_fetch_lengths_oo.phpt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,8 @@ require_once 'skipifconnectfailure.inc';
88
?>
99
--FILE--
1010
<?php
11-
require_once 'connect.inc';
12-
13-
if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
14-
printf("[001] Cannot connect\n");
15-
1611
require 'table.inc';
12+
$mysqli = $link;
1713
if (!$res = $mysqli->query("SELECT id, label FROM test ORDER BY id LIMIT 1")) {
1814
printf("[002] [%d] %s\n", $mysqli->errno, $mysqli->error);
1915
}

ext/mysqli/tests/mysqli_fetch_object.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ require_once 'skipifconnectfailure.inc';
88
?>
99
--FILE--
1010
<?php
11-
include_once 'connect.inc';
12-
1311
require 'table.inc';
1412
if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 5")) {
1513
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));

ext/mysqli/tests/mysqli_fetch_object_no_constructor.phpt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@ require_once 'skipifconnectfailure.inc';
88
?>
99
--FILE--
1010
<?php
11-
require_once 'connect.inc';
12-
13-
$tmp = NULL;
14-
$link = NULL;
15-
1611
require 'table.inc';
1712
if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 5")) {
1813
printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));

ext/mysqli/tests/mysqli_fetch_object_oo.phpt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ require_once 'skipifconnectfailure.inc';
88
?>
99
--FILE--
1010
<?php
11-
require_once 'connect.inc';
12-
1311
$mysqli = new mysqli();
1412
try {
1513
new mysqli_result($mysqli);
@@ -18,9 +16,7 @@ require_once 'skipifconnectfailure.inc';
1816
}
1917

2018
require 'table.inc';
21-
if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
22-
printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
23-
$host, $user, $db, $port, $socket);
19+
$mysqli = $link;
2420

2521
if (!$res = $mysqli->query("SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 5")) {
2622
printf("[003] [%d] %s\n", $mysqli->errno, $mysqli->error);

ext/mysqli/tests/mysqli_fetch_row.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ require_once 'skipifconnectfailure.inc';
88
?>
99
--FILE--
1010
<?php
11-
require_once 'connect.inc';
12-
1311
require 'table.inc';
1412
if (!$res = mysqli_query($link, "SELECT id, label, id AS _id FROM test ORDER BY id LIMIT 1")) {
1513
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));

ext/mysqli/tests/mysqli_field_count.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ require_once 'skipifconnectfailure.inc';
88
?>
99
--FILE--
1010
<?php
11-
require_once 'connect.inc';
12-
1311
require 'table.inc';
1412

1513
var_dump(mysqli_field_count($link));

ext/mysqli/tests/mysqli_field_seek.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ require_once 'skipifconnectfailure.inc';
5454
return $ret;
5555
}
5656

57-
require_once 'connect.inc';
58-
5957
require 'table.inc';
6058

6159
// Make sure that client, connection and result charsets are all the

ext/mysqli/tests/mysqli_field_tell.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ require_once 'skipifconnectfailure.inc';
88
?>
99
--FILE--
1010
<?php
11-
require_once 'connect.inc';
12-
1311
require 'table.inc';
1412
if (!$res = mysqli_query($link, "SELECT id FROM test ORDER BY id LIMIT 1", MYSQLI_USE_RESULT)) {
1513
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));

ext/mysqli/tests/mysqli_free_result.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ require_once 'skipifconnectfailure.inc';
88
?>
99
--FILE--
1010
<?php
11-
require_once 'connect.inc';
12-
1311
require 'table.inc';
1412
if (!$res = mysqli_query($link, "SELECT id FROM test ORDER BY id LIMIT 1")) {
1513
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));

ext/mysqli/tests/mysqli_get_charset.phpt

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@ require_once 'skipifconnectfailure.inc';
99
--FILE--
1010
<?php
1111
require_once 'connect.inc';
12-
13-
require 'table.inc';
12+
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
13+
printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
14+
$host, $user, $db, $port, $socket);
15+
exit(1);
16+
}
1417

1518
if (!$res = mysqli_query($link, 'SELECT version() AS server_version'))
1619
printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
@@ -95,10 +98,6 @@ require_once 'skipifconnectfailure.inc';
9598

9699
print "done!";
97100
?>
98-
--CLEAN--
99-
<?php
100-
require_once 'clean_table.inc';
101-
?>
102101
--EXPECT--
103102
mysqli object is already closed
104103
done!

0 commit comments

Comments
 (0)