Skip to content

Commit 8573eb9

Browse files
kamil-tekielanikic
authored andcommitted
Add CLEAN sections to mysqli and PDO mysql tests
Closes GH-6756.
1 parent 3b9ea4d commit 8573eb9

14 files changed

+88
-17
lines changed

ext/mysqli/tests/bug66124.phpt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ require_once('skipifconnectfailure.inc');
88
?>
99
--FILE--
1010
<?php
11-
$table_drop = "DROP TABLE IF EXISTS `bug66124`";
12-
$table_create = "CREATE TABLE `bug66124` (
11+
$table_drop = "DROP TABLE IF EXISTS `test`";
12+
$table_create = "CREATE TABLE `test` (
1313
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
1414
PRIMARY KEY (`id`)
1515
) ENGINE=InnoDB DEFAULT CHARSET=utf8";
1616

17-
$table_insert = "INSERT INTO `bug66124` SET `id`=?";
18-
$table_select = "SELECT * FROM `bug66124`";
19-
$table_delete = "DELETE FROM `bug66124`";
17+
$table_insert = "INSERT INTO `test` SET `id`=?";
18+
$table_select = "SELECT * FROM `test`";
19+
$table_delete = "DELETE FROM `test`";
2020
$id = '1311200011005001566';
2121

2222

@@ -91,6 +91,10 @@ if ($result){
9191
$link->close();
9292
?>
9393
done
94+
--CLEAN--
95+
<?php
96+
require_once "clean_table.inc";
97+
?>
9498
--EXPECT--
9599
Using 'i':
96100
insert id:1311200011005001566=>1311200011005001566

ext/mysqli/tests/bug75018.phpt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ require_once("connect.inc");
1111

1212
$mysqli = new mysqli("$host:$port", $user, $passwd, $db);
1313

14-
$tbl = "test_bug75018";
14+
$tbl = "test";
1515
$sql = "DROP TABLE IF EXISTS $tbl";
1616
$mysqli->query($sql);
1717

@@ -30,6 +30,10 @@ while ($row = $result->fetch_assoc()) {
3030
var_dump($row['bit_column_1']);
3131
}
3232

33+
?>
34+
--CLEAN--
35+
<?php
36+
require_once "clean_table.inc";
3337
?>
3438
--EXPECT--
3539
string(1) "0"

ext/mysqli/tests/bug77597.phpt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,21 @@ if (!defined('MYSQLI_STORE_RESULT_COPY_DATA')) die('skip requires mysqlnd');
1212
require_once("connect.inc");
1313
$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
1414

15-
$mysqli->query('DROP TABLE IF EXISTS a');
16-
$mysqli->query('CREATE TABLE a (b int)');
17-
$mysqli->query('INSERT INTO a VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9)');
15+
$mysqli->query('DROP TABLE IF EXISTS test');
16+
$mysqli->query('CREATE TABLE test (b int)');
17+
$mysqli->query('INSERT INTO test VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9)');
1818

19-
$mysqli->real_query("SELECT * FROM a");
19+
$mysqli->real_query("SELECT * FROM test");
2020

2121
$result = $mysqli->store_result(MYSQLI_STORE_RESULT_COPY_DATA);
2222

2323
$field = $result->fetch_field();
2424
var_dump($field->name);
2525

26+
?>
27+
--CLEAN--
28+
<?php
29+
require_once "clean_table.inc";
2630
?>
2731
--EXPECT--
2832
string(1) "b"

ext/mysqli/tests/bug77935.phpt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ while ($row = $result->fetch_assoc()) {
3030
var_dump($row);
3131
}
3232

33+
?>
34+
--CLEAN--
35+
<?php
36+
require_once 'connect.inc';
37+
$link = new mysqli($host, $user, $passwd, $db, $port, $socket);
38+
$link->query('DROP PROCEDURE IF EXISTS testSp');
39+
$link->close();
3340
?>
3441
--EXPECT--
3542
array(1) {

ext/mysqli/tests/connect.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
if (!function_exists('my_mysqli_connect')) {
5252

5353
/**
54-
* Whenever possible, please use this wrapper to make testing ot MYSQLI_CLIENT_COMPRESS (and potentially SSL) possible
54+
* Whenever possible, please use this wrapper to make testing of MYSQLI_CLIENT_COMPRESS (and potentially SSL) possible
5555
*
5656
* @param enable_env_flags Enable setting of connection flags through env(MYSQL_TEST_CONNECT_FLAGS)?
5757
*/
@@ -71,7 +71,7 @@
7171
}
7272

7373
/**
74-
* Whenever possible, please use this wrapper to make testing ot MYSQLI_CLIENT_COMPRESS (and potentially SSL) possible
74+
* Whenever possible, please use this wrapper to make testing of MYSQLI_CLIENT_COMPRESS (and potentially SSL) possible
7575
*
7676
* @param enable_env_flags Enable setting of connection flags through env(MYSQL_TEST_CONNECT_FLAGS)
7777
*/

ext/mysqli/tests/mysqli_insert_packet_overflow.phpt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,5 +113,12 @@ memory_limit=256M
113113

114114
print "done!";
115115
?>
116+
--CLEAN--
117+
<?php
118+
require_once 'connect.inc';
119+
$link = new mysqli($host, $user, $passwd, $db, $port, $socket);
120+
$link->query('DROP TABLE test__mysqli_insert_packet_overflow');
121+
$link->close();
122+
?>
116123
--EXPECT--
117124
done!

ext/mysqli/tests/mysqli_query_unicode.phpt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,14 @@ mysqli_close($link);
8282

8383
print "done!";
8484
?>
85+
--CLEAN--
86+
<?php
87+
require_once 'connect.inc';
88+
$link = new mysqli($host, $user, $passwd, $db, $port, $socket);
89+
$link->query('DROP PROCEDURE IF EXISTS процедурка');
90+
$link->query('DROP FUNCTION IF EXISTS функцийка');
91+
$link->close();
92+
?>
8593
--EXPECTF--
8694
array(1) {
8795
["правилен"]=>

ext/mysqli/tests/mysqli_stmt_multires.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,10 @@ require_once('skipifconnectfailure.inc');
9494
?>
9595
--CLEAN--
9696
<?php
97-
require_once("connect.inc");
98-
if (!$link->query('DROP PROCEDURE IF EXISTS p123')) {
99-
printf("[001] [%d] %s\n", $link->error, $link->errno);
100-
}
97+
require_once 'connect.inc';
98+
$link = new mysqli($host, $user, $passwd, $db, $port, $socket);
99+
$link->query('DROP PROCEDURE IF EXISTS p123');
100+
$link->close();
101101
?>
102102
--EXPECT--
103103
string(4) "pre:"

ext/mysqli/tests/ps_cursor_multiple_result_sets.phpt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@ while ($row = $result->fetch_assoc()) {
7070
}
7171
$stmt->next_result();
7272

73+
?>
74+
--CLEAN--
75+
<?php
76+
require_once 'connect.inc';
77+
$link = new mysqli($host, $user, $passwd, $db, $port, $socket);
78+
$link->query('DROP PROCEDURE IF EXISTS testPs');
79+
$link->close();
7380
?>
7481
--EXPECT--
7582
use_result:

ext/pdo_mysql/tests/bug63185.phpt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ try {
4141
}
4242
var_dump($st->fetchAll());
4343

44+
?>
45+
--CLEAN--
46+
<?php
47+
require_once __DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc';
48+
$pdo = MySQLPDOTest::factory();
49+
$pdo->query('DROP PROCEDURE IF EXISTS test_procedure_error_at_second');
4450
?>
4551
--EXPECTF--
4652
array(1) {

ext/pdo_mysql/tests/bug75177.phpt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ if (!MySQLPDOTest::isPDOMySQLnd()) die('skip only for mysqlnd');
1212
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
1313
$pdo = MySQLPDOTest::factory();
1414

15-
$tbl = "tbl_bug75177";
15+
$tbl = "test";
1616
$pdo->query("DROP TABLE IF EXISTS $tbl");
1717
$pdo->query("CREATE TABLE $tbl (`bit` bit(8)) ENGINE=InnoDB");
1818
$pdo->query("INSERT INTO $tbl (`bit`) VALUES (1)");
@@ -31,6 +31,11 @@ foreach ($ret as $i) {
3131
var_dump($i["bit"]);
3232
}
3333

34+
?>
35+
--CLEAN--
36+
<?php
37+
require dirname(__FILE__) . '/mysql_pdo_test.inc';
38+
MySQLPDOTest::dropTestTable();
3439
?>
3540
--EXPECT--
3641
int(1)

ext/pdo_mysql/tests/bug76815.phpt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ try {
2727
unset($st);
2828
echo "Ok.\n";
2929

30+
?>
31+
--CLEAN--
32+
<?php
33+
require_once __DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc';
34+
$pdo = MySQLPDOTest::factory();
35+
$pdo->query('DROP FUNCTION IF EXISTS tst');
36+
$pdo->query('DROP PROCEDURE IF EXISTS tst2');
3037
?>
3138
--EXPECT--
3239
SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'tst()' at row 1

ext/pdo_mysql/tests/bug_41997.phpt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
3737
var_dump($stmt->errorInfo());
3838
print "done!";
3939
?>
40+
--CLEAN--
41+
<?php
42+
require_once __DIR__ . '/mysql_pdo_test.inc';
43+
$db = MySQLPDOTest::factory();
44+
$db->exec("DROP PROCEDURE IF EXISTS p");
45+
?>
4046
--EXPECT--
4147
array(1) {
4248
[0]=>

ext/pdo_mysql/tests/pdo_mysql_stmt_variable_columncount.phpt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,5 +117,11 @@ if ($version < 50000)
117117

118118
print "done!";
119119
?>
120+
--CLEAN--
121+
<?php
122+
require_once __DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc';
123+
$pdo = MySQLPDOTest::factory();
124+
$pdo->query('DROP PROCEDURE IF EXISTS p');
125+
?>
120126
--EXPECT--
121127
done!

0 commit comments

Comments
 (0)